Module: Coaster::CssHashString::StringToStyle
- Defined in:
- lib/coaster/core_ext/css_hash_string.rb
Instance Method Summary collapse
Instance Method Details
#to_css_hash(**defaults) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/coaster/core_ext/css_hash_string.rb', line 32 def to_css_hash(**defaults) defaults.with_indifferent_access.merge( self.split(';').map do |pair| k, v = pair.split(':') [k.strip, v.strip] end.to_h ) end |
#to_css_style(**defaults) ⇒ Object
27 28 29 30 |
# File 'lib/coaster/core_ext/css_hash_string.rb', line 27 def to_css_style(**defaults) return self unless defaults.present? to_css_hash(**defaults).to_css_style end |