class Terrazine::Row
respresent result row
Public Class Methods
new(pg_result, values)
click to toggle source
attr_reader :pg_result, :values
# File lib/terrazine/result.rb, line 8 def initialize(pg_result, values) # @pg_result = pg_result # @values = values # Hiding from console a lot of data lines-_- ... another method? define_singleton_method(:pg_result) { pg_result } define_singleton_method(:values) { values } end
Public Instance Methods
method_missing(method_name, *_)
click to toggle source
Calls superclass method
# File lib/terrazine/result.rb, line 20 def method_missing(method_name, *_) indx = index(method_name.to_s) indx || super return unless values values[indx] end
respond_to_missing?(method_name, include_all = true)
click to toggle source
Calls superclass method
# File lib/terrazine/result.rb, line 16 def respond_to_missing?(method_name, include_all = true) index(method_name.to_s) || super end
to_h()
click to toggle source
# File lib/terrazine/result.rb, line 27 def to_h return {} unless values.present? pg_result.fields.zip(values).to_h end