lib/influxer/metrics/relation.rb in influxer-1.0.1 vs lib/influxer/metrics/relation.rb in influxer-1.1.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'active_support/core_ext/module/delegation'
require 'influxer/metrics/relation/time_query'
require 'influxer/metrics/relation/calculations'
require 'influxer/metrics/relation/where_clause'
@@ -11,21 +13,21 @@
include Influxer::Calculations
include Influxer::WhereClause
attr_reader :values
- SUPPORTED_EPOCH_FORMAT = %i(h m s ms u ns).freeze
+ SUPPORTED_EPOCH_FORMAT = %i[h m s ms u ns].freeze
- MULTI_VALUE_METHODS = %i(select where group order).freeze
+ MULTI_VALUE_METHODS = %i[select where group order].freeze
- MULTI_KEY_METHODS = %i(fanout).freeze
+ MULTI_KEY_METHODS = %i[fanout].freeze
- SINGLE_VALUE_METHODS = %i(fill time limit offset slimit soffset from normalized).freeze
+ SINGLE_VALUE_METHODS = %i[fill time limit offset slimit soffset from normalized].freeze
- MULTI_VALUE_SIMPLE_METHODS = %i(select group).freeze
+ MULTI_VALUE_SIMPLE_METHODS = %i[select group].freeze
- SINGLE_VALUE_SIMPLE_METHODS = %i(fill limit offset slimit soffset from).freeze
+ SINGLE_VALUE_SIMPLE_METHODS = %i[fill limit offset slimit soffset from].freeze
MULTI_VALUE_METHODS.each do |name|
class_eval <<-CODE, __FILE__, __LINE__ + 1
def #{name}_values # def select_values
@values[:#{name}] ||= [] # @values[:select] || []
@@ -192,11 +194,13 @@
def load
@records = get_points(
@instance.client.query(
to_sql,
denormalize: !normalized?,
- epoch: @values[:epoch]))
+ epoch: @values[:epoch]
+ )
+ )
@loaded = true
@records
end
def delete_all
@@ -285,8 +289,13 @@
end
def method_missing(method, *args, &block)
return super unless @klass.respond_to?(method)
merge!(scoping { @klass.public_send(method, *args, &block) })
+ end
+
+ def respond_to_missing?(method, *args)
+ return true if @klass.respond_to?(method)
+ super
end
end
end