class Djoini::Fields
Holds all fields and values in rowobject
Attributes
data[RW]
Public Class Methods
new(params)
click to toggle source
# File lib/djoini/fields.rb, line 4 def initialize(params) self.data = {} attributes = params.fetch(:attributes) values = params.fetch(:values, {}) attributes.each { |name| data[name] = values[name.to_s] } build_accessors(attributes) end
Public Instance Methods
clone_hash()
click to toggle source
# File lib/djoini/fields.rb, line 15 def clone_hash data.clone end
Private Instance Methods
build_accessors(attributes)
click to toggle source
# File lib/djoini/fields.rb, line 23 def build_accessors(attributes) attributes.each do |name| define_singleton_method(name) { data[name] } define_singleton_method("#{name}=") { |value| data[name] = value } end end