Module: HtmlFn::Attributes
- Defined in:
- lib/html_fn/attributes.rb
Constant Summary collapse
- @@merge_attrs =
Your code goes here… module HtmlFnc
->hash { hash.inject({}) do |group, (key, values)| group[key] ||= [] group[key] += [values] group end.map { |key, val| [key, val.join(" ")] }.to_h }
- @@attrs_to_s =
->attrs { merged = @@merge_attrs.(attrs) merged.map do |(attr_name, values)| %{#{attr_name}="#{values}"} end.join(" ") }
- @@string_property =
->name, string { [name, string] }.curry
- @@style =
->styles { string_property.("style"). (styles.map { |(key, val)| %{#{key}: #{val};} }.join(" ")) }
- @@class_ =
string_property.(:class)
- @@id_ =
string_property.(:id)
- @@name_ =
string_property.(:name)
- @@content =
string_property.(:content)
- @@href =
string_property.(:href)
- @@rel =
string_property.(:rel)