Class: Interview::List
- Defined in:
- lib/interview/controls/list.rb
Instance Attribute Summary collapse
-
#empty_message ⇒ Object
Returns the value of attribute empty_message.
-
#object ⇒ Object
Returns the value of attribute object.
-
#objects ⇒ Object
Returns the value of attribute objects.
Attributes inherited from Control
Instance Method Summary collapse
Methods inherited from Control
#ancestors, #build_child, #build_with_params, #find_attribute, #find_attribute!, #initialize, #set_attributes, #set_defaults
Constructor Details
This class inherits a constructor from Interview::Control
Instance Attribute Details
#empty_message ⇒ Object
Returns the value of attribute empty_message.
4 5 6 |
# File 'lib/interview/controls/list.rb', line 4 def @empty_message end |
#object ⇒ Object
Returns the value of attribute object.
4 5 6 |
# File 'lib/interview/controls/list.rb', line 4 def object @object end |
#objects ⇒ Object
Returns the value of attribute objects.
4 5 6 |
# File 'lib/interview/controls/list.rb', line 4 def objects @objects end |
Instance Method Details
#build(b) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/interview/controls/list.rb', line 6 def build(b) objects = @objects || find_attribute!(:objects) objects.each do |object| @object = object yield if block_given? end if objects.empty? and @empty_message != :hide object = @object || find_attribute!(:object) = @empty_message || "Keine #{object.class.human_name(count: 2)} vorhanden." # todo b.text text: , style: 'p', html_class: 'text-center text-muted' end end |