Class: Reform::Representer
- Inherits:
-
Representable::Decorator
- Object
- Representable::Decorator
- Reform::Representer
- Includes:
- Representable::Hash
- Defined in:
- lib/reform/representer.rb
Defined Under Namespace
Modules: WithOptions
Class Method Summary collapse
-
.clone ⇒ Object
called in inheritable_attr :representer_class.
Instance Method Summary collapse
-
#fields ⇒ Object
Returns hash of all property names.
- #nested_forms(&block) ⇒ Object
Class Method Details
.clone ⇒ Object
called in inheritable_attr :representer_class.
50 51 52 |
# File 'lib/reform/representer.rb', line 50 def self.clone # called in inheritable_attr :representer_class. Class.new(self) # By subclassing, representable_attrs.clone is called. end |
Instance Method Details
#fields ⇒ Object
Returns hash of all property names.
39 40 41 |
# File 'lib/reform/representer.rb', line 39 def fields representable_attrs.map(&:name) end |
#nested_forms(&block) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/reform/representer.rb', line 43 def nested_forms(&block) clone_config!. find_all { |attr| attr.[:form] }. collect { |attr| [attr, represented.send(attr.getter)] }. # DISCUSS: can't we do this with the Binding itself? each(&block) end |