Module: WiseGopher::Base::Methods

Extended by:
Forwardable
Defined in:
lib/wise_gopher/base.rb

Overview

instance methods for WiseGopher::Base

Instance Method Summary collapse

Instance Method Details

#executeObject



111
112
113
114
115
116
117
118
119
# File 'lib/wise_gopher/base.rb', line 111

def execute
  ensure_row_class_is_declared

  result = connection.exec_query(query.squish, query_class.to_s, @binds, prepare: true)

  ensure_all_columns_are_declared(result)

  result.entries.map { |entry| row_class.new(entry) }
end

#initialize(inputs = {}) ⇒ Object



101
102
103
104
105
106
107
108
109
# File 'lib/wise_gopher/base.rb', line 101

def initialize(inputs = {})
  @inputs         = inputs
  @binds          = []
  @query_prepared = false

  self.class.ensure_all_params_are_given(inputs)

  prepare_query
end

#prepare_queryObject



121
122
123
124
125
126
127
128
129
# File 'lib/wise_gopher/base.rb', line 121

def prepare_query
  return if @query_prepared

  prepare_raw_params

  prepare_params

  @query_prepared = true
end