Class: HtmlOptions
- Inherits:
-
Object
- Object
- HtmlOptions
- Defined in:
- lib/showcase/helpers/html_options.rb
Instance Method Summary collapse
- #add_class!(css_class) ⇒ Object
-
#initialize(options = {}) ⇒ HtmlOptions
constructor
A new instance of HtmlOptions.
- #merge_attrs!(options = {}) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ HtmlOptions
Returns a new instance of HtmlOptions.
2 3 4 |
# File 'lib/showcase/helpers/html_options.rb', line 2 def initialize( = {}) = ( || {}).symbolize_keys end |
Instance Method Details
#add_class!(css_class) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/showcase/helpers/html_options.rb', line 6 def add_class!(css_class) [:class] ||= "" css_classes = [:class].split(/\s+/) css_classes << css_class [:class] = css_classes.join(" ") end |
#merge_attrs!(options = {}) ⇒ Object
13 14 15 16 |
# File 'lib/showcase/helpers/html_options.rb', line 13 def merge_attrs!( = {}) = ( || {}).symbolize_keys .merge!() end |
#to_h ⇒ Object
18 19 20 |
# File 'lib/showcase/helpers/html_options.rb', line 18 def to_h .dup end |