Class: InfluxDB::Query::Builder
- Inherits:
-
Object
- Object
- InfluxDB::Query::Builder
- Defined in:
- lib/influxdb/query/builder.rb
Instance Method Summary collapse
Instance Method Details
#build(query, params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/influxdb/query/builder.rb', line 4 def build(query, params) case params when Array then params = params_from_array(params) when Hash then params = params_from_hash(params) when NilClass then params = {} else raise ArgumentError, "Unsupported #{params.class} params" end query % params rescue KeyError => e raise ArgumentError, e. end |
#quote(param) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/influxdb/query/builder.rb', line 17 def quote(param) case param when String, Symbol "'".freeze + param.to_s.gsub(/['"\\\x0]/, '\\\\\0') + "'".freeze when Integer, Float, TrueClass, FalseClass param.to_s else raise ArgumentError, "Unexpected parameter type #{param.class} (#{param.inspect})" end end |