Class: Reform::Representer
- Inherits:
-
Representable::Decorator
- Object
- Representable::Decorator
- Reform::Representer
- Extended by:
- Uber::InheritableAttr
- Includes:
- Representable::Hash, Representable::Hash::AllowSymbols
- Defined in:
- lib/reform/representer.rb
Defined Under Namespace
Modules: WithOptions
Class Method Summary collapse
-
.clone ⇒ Object
called in inheritable_attr :representer_class.
- .default_inline_class ⇒ Object
- .for(options) ⇒ Object
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.
66 67 68 |
# File 'lib/reform/representer.rb', line 66 def self.clone # called in inheritable_attr :representer_class. Class.new(self) # By subclassing, representable_attrs.clone is called. end |
.default_inline_class ⇒ Object
62 63 64 |
# File 'lib/reform/representer.rb', line 62 def self.default_inline_class [:form_class] end |
.for(options) ⇒ Object
56 57 58 59 60 |
# File 'lib/reform/representer.rb', line 56 def self.for() clone.tap do |representer| representer. = end end |
Instance Method Details
#fields ⇒ Object
Returns hash of all property names.
46 47 48 |
# File 'lib/reform/representer.rb', line 46 def fields representable_attrs.map(&:name) end |
#nested_forms(&block) ⇒ Object
50 51 52 53 54 |
# File 'lib/reform/representer.rb', line 50 def nested_forms(&block) clone_config!. find_all { |attr| attr[:form] }. each(&block) end |