Class: Djoini::Fields

Inherits:
Object
  • Object
show all
Defined in:
lib/djoini/fields.rb

Overview

Holds all fields and values in rowobject

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Fields

Returns a new instance of Fields.



4
5
6
7
8
9
10
11
12
13
# 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

Instance Method Details

#clone_hashObject



15
16
17
# File 'lib/djoini/fields.rb', line 15

def clone_hash
  data.clone
end