Module: SQLite3::Record::ClassMethods

Defined in:
lib/sqlite3/record.rb,
lib/to_js.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



8
9
10
# File 'lib/sqlite3/record.rb', line 8

def columns
  @columns
end

Instance Method Details

#build(*attrs) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sqlite3/record.rb', line 27

def build(*attrs)
  attrs = columns.zip(attrs).map do |key, value|
    case key
    when /_at$/ then to_time(value)
    when /_on$/ then to_date(value)
    else value
    end
  end

  new *attrs
end

#convert_to_jsObject



50
51
52
# File 'lib/to_js.rb', line 50

def convert_to_js
  to_hash.convert_to_js
end