Class: SimpleAttribute::Attributes::Link
- Defined in:
- lib/simple_attribute/attributes/link.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#attribute, #options, #record, #value
Instance Method Summary collapse
Methods inherited from Base
#default_value, #defaults, #html_options, #initialize, #method_missing, #render, #render_default_value, #render_with_default, #render_wrapper, #renderer_name, #value?, #wrapper, #wrapper?, #wrapper_html
Constructor Details
This class inherits a constructor from SimpleAttribute::Attributes::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SimpleAttribute::Attributes::Base
Instance Method Details
#attribute_name ⇒ Object
4 5 6 |
# File 'lib/simple_attribute/attributes/link.rb', line 4 def attribute_name 'link' end |
#label_method ⇒ Object
8 9 10 |
# File 'lib/simple_attribute/attributes/link.rb', line 8 def label_method @options.fetch(:label, :titleize) end |
#render_attribute ⇒ Object
16 17 18 19 20 21 |
# File 'lib/simple_attribute/attributes/link.rb', line 16 def render_attribute label = value.try(label_method) title = value.try(title_method) link_to label, value.to_s, .merge(title: title) end |
#title_method ⇒ Object
12 13 14 |
# File 'lib/simple_attribute/attributes/link.rb', line 12 def title_method @options.fetch(:title, :titleize) end |