Skip to content

Instantly share code, notes, and snippets.

@paulcsmith
Created December 20, 2018 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulcsmith/3d1b521e75b2a4e6bffa8a971ad96876 to your computer and use it in GitHub Desktop.
Save paulcsmith/3d1b521e75b2a4e6bffa8a971ad96876 to your computer and use it in GitHub Desktop.
d("#foo.whatever.foo") do
end
private def d(id_and_or_class : String, **other_args)
id = id_and_or_class.split(".").find?(&.starts_with?("#"))
classes = id_and_or_class.split(".").reject(&.starts_with?("#"))
div(id: id.to_s, class: classes.join(" "), **other_args) do
yield
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment