Class: Trifle::Ruby::Operations::Timeseries::Increment
- Inherits:
-
Object
- Object
- Trifle::Ruby::Operations::Timeseries::Increment
- Defined in:
- lib/trifle/ruby/operations/timeseries/increment.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(**keywords) ⇒ Increment
constructor
A new instance of Increment.
- #perform ⇒ Object
Constructor Details
#initialize(**keywords) ⇒ Increment
Returns a new instance of Increment.
10 11 12 13 14 15 |
# File 'lib/trifle/ruby/operations/timeseries/increment.rb', line 10 def initialize(**keywords) @key = keywords.fetch(:key) @at = keywords.fetch(:at) @values = keywords.fetch(:values) @config = keywords[:config] end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/trifle/ruby/operations/timeseries/increment.rb', line 8 def key @key end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
8 9 10 |
# File 'lib/trifle/ruby/operations/timeseries/increment.rb', line 8 def values @values end |
Instance Method Details
#config ⇒ Object
17 18 19 |
# File 'lib/trifle/ruby/operations/timeseries/increment.rb', line 17 def config @config || Trifle::Ruby.default end |
#perform ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/trifle/ruby/operations/timeseries/increment.rb', line 21 def perform config.ranges.map do |range| at = Nocturnal.new(@at, config: config).send(range) config.driver.inc( key: [key, range, at.to_i].join(config.separator), **values ) end end |