Module: NForm::Attributes::InstanceMethods
- Defined in:
- lib/nform/attributes.rb
Instance Method Summary collapse
Instance Method Details
#initialize(input = nil) ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/nform/attributes.rb', line 75 def initialize(input=nil) input ||= {} @__touched_keys = Set.new i = input.symbolize_keys require_attributes!(i) self.class.define_attributes set_attributes!(i) end |
#to_hash ⇒ Object
84 85 86 87 88 89 90 91 92 |
# File 'lib/nform/attributes.rb', line 84 def to_hash if self.class.__hash_rep == :partial @__touched_keys else self.class.attribute_set.keys end.each.with_object({}) do |k,memo| memo[k] = send(k) end end |