Module: MiniSql::Result

Defined in:
lib/mini_sql/result.rb

Instance Method Summary collapse

Instance Method Details

#==(other_result) ⇒ Object



20
21
22
23
24
# File 'lib/mini_sql/result.rb', line 20

def ==(other_result)
  self.class.decorator == other_result.class.decorator &&
  self.instance_variables == other_result.instance_variables &&
  self.values == other_result.values
end

#eql?(other_result) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/mini_sql/result.rb', line 26

def eql?(other_result)
  self == other_result
end

#to_hObject



8
9
10
11
12
13
14
# File 'lib/mini_sql/result.rb', line 8

def to_h
  r = {}
  instance_variables.each do |f|
    r[f.to_s.delete_prefix('@').to_sym] = instance_variable_get(f)
  end
  r
end

#valuesObject



16
17
18
# File 'lib/mini_sql/result.rb', line 16

def values
  instance_variables.map { |f| instance_variable_get(f) }
end