Class: RubyQL
- Inherits:
-
Object
- Object
- RubyQL
- Defined in:
- lib/rubyql.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(params, json = false) ⇒ RubyQL
constructor
A new instance of RubyQL.
- #query_params ⇒ Object
Constructor Details
#initialize(params, json = false) ⇒ RubyQL
Returns a new instance of RubyQL.
4 5 6 7 8 9 10 |
# File 'lib/rubyql.rb', line 4 def initialize(params, json = false) if json @params = JSON.parse(params) else @params = params end end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
2 3 4 |
# File 'lib/rubyql.rb', line 2 def params @params end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 |
# File 'lib/rubyql.rb', line 12 def execute query.select do |key, value| response_attr.key? key end.merge query_params end |
#query_params ⇒ Object
18 19 20 21 22 |
# File 'lib/rubyql.rb', line 18 def query_params @params.reject do |key, value| value == '' || value.nil? end end |