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
Classes: Options
Class Method Summary collapse
-
.clone ⇒ Object
called in inheritable_attr :representer_class.
- .default_inline_class ⇒ Object
- .each(only_form = true, &block) ⇒ Object
-
.fields(&block) ⇒ Object
Returns hash of all property names.
- .for(options) ⇒ Object
Class Method Details
.clone ⇒ Object
called in inheritable_attr :representer_class.
59 60 61 |
# File 'lib/reform/representer.rb', line 59 def self.clone # called in inheritable_attr :representer_class. Class.new(self) # By subclassing, representable_attrs.clone is called. end |
.default_inline_class ⇒ Object
55 56 57 |
# File 'lib/reform/representer.rb', line 55 def self.default_inline_class [:form_class] end |
.each(only_form = true, &block) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/reform/representer.rb', line 41 def self.each(only_form=true, &block) definitions = representable_attrs definitions = representable_attrs.find_all { |attr| attr[:form] } if only_form definitions.each(&block) self end |
.fields(&block) ⇒ Object
Returns hash of all property names.
37 38 39 |
# File 'lib/reform/representer.rb', line 37 def self.fields(&block) representable_attrs.find_all(&block).map(&:name) end |
.for(options) ⇒ Object
49 50 51 52 53 |
# File 'lib/reform/representer.rb', line 49 def self.for() clone.tap do |representer| representer. = end end |