Module: WiseGopher::Row

Defined in:
lib/wise_gopher/row.rb

Overview

This Module handles the declartion of row’s columns of query result and defines the getters for row objects

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/wise_gopher/row.rb', line 7

def self.included(base)
  base.class_eval do
    @columns         = {}
    @ignored_columns = []
  end

  base.extend(ClassMethods)
end

Instance Method Details

#initialize(entry) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/wise_gopher/row.rb', line 33

def initialize(entry)
  self.class.columns.each do |name, column|
    variable_name = column.instance_variable_name.freeze

    instance_variable_set(variable_name, column.cast(entry[name]))
  end
end