Class: BrainDamage::Templateable::FieldTemplateable
- Defined in:
- lib/generators/brain_damage/lib/templateable/field_templateable.rb
Direct Known Subclasses
View::Display::Base, View::Display::Hidden, View::Input::Base, View::Label::Base
Instance Attribute Summary collapse
-
#partial_html ⇒ Object
readonly
Returns the value of attribute partial_html.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Base
#inner_html, #options, #template_file
Instance Method Summary collapse
- #empty_haml_path ⇒ Object
-
#initialize(field, options) ⇒ FieldTemplateable
constructor
A new instance of FieldTemplateable.
- #label_guard? ⇒ Boolean
- #method_missing(method, *args, &block) ⇒ Object
- #render ⇒ Object
- #show? ⇒ Boolean
- #show_label? ⇒ Boolean
Methods inherited from Base
#indent, #render_erb_file, #render_erb_string, #render_template_file
Constructor Details
#initialize(field, options) ⇒ FieldTemplateable
Returns a new instance of FieldTemplateable.
9 10 11 12 13 14 15 |
# File 'lib/generators/brain_damage/lib/templateable/field_templateable.rb', line 9 def initialize(field, ) @field = field @type = self.class.to_s.split('::').last.underscore.to_sym resource = field.resource super resource, end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
21 22 23 |
# File 'lib/generators/brain_damage/lib/templateable/field_templateable.rb', line 21 def method_missing(method, *args, &block) @field.send method, *args, &block end |
Instance Attribute Details
#partial_html ⇒ Object (readonly)
Returns the value of attribute partial_html.
7 8 9 |
# File 'lib/generators/brain_damage/lib/templateable/field_templateable.rb', line 7 def partial_html @partial_html end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/generators/brain_damage/lib/templateable/field_templateable.rb', line 6 def type @type end |
Instance Method Details
#empty_haml_path ⇒ Object
17 18 19 |
# File 'lib/generators/brain_damage/lib/templateable/field_templateable.rb', line 17 def empty_haml_path 'brain_damage/empty' end |
#label_guard? ⇒ Boolean
25 26 27 |
# File 'lib/generators/brain_damage/lib/templateable/field_templateable.rb', line 25 def label_guard? false end |
#render ⇒ Object
37 38 39 |
# File 'lib/generators/brain_damage/lib/templateable/field_templateable.rb', line 37 def render super end |
#show? ⇒ Boolean
33 34 35 |
# File 'lib/generators/brain_damage/lib/templateable/field_templateable.rb', line 33 def show? true end |
#show_label? ⇒ Boolean
29 30 31 |
# File 'lib/generators/brain_damage/lib/templateable/field_templateable.rb', line 29 def show_label? true end |