Module: BellyWash
- Defined in:
- lib/belly_wash.rb,
lib/belly_wash/client.rb,
lib/belly_wash/version.rb,
lib/belly_wash/resource.rb,
lib/belly_wash/nocturnal.rb,
lib/belly_wash/driver/redis.rb,
lib/belly_wash/configuration.rb,
lib/belly_wash/mixins/packer.rb
Defined Under Namespace
Modules: Driver, Mixins
Classes: Client, Configuration, Error, Nocturnal, Resource
Constant Summary
collapse
- VERSION =
'0.1.1'
Class Method Summary
collapse
Class Method Details
.client ⇒ Object
24
25
26
|
# File 'lib/belly_wash.rb', line 24
def self.client
@client ||= Client.new
end
|
.config ⇒ Object
14
15
16
|
# File 'lib/belly_wash.rb', line 14
def self.config
@config ||= Configuration.new
end
|
18
19
20
21
22
|
# File 'lib/belly_wash.rb', line 18
def self.configure
yield(config)
config
end
|
.track(key:, at:, values:) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/belly_wash.rb', line 28
def self.track(key:, at:, values:)
config.ranges.map do |range|
Resource.new(
key: key,
range: range,
at: Nocturnal.new(at).send("beginning_of_#{range}")
).increment(**values)
end
end
|
.values_for(key:, from:, to:, range:) ⇒ Object
38
39
40
41
42
|
# File 'lib/belly_wash.rb', line 38
def self.values_for(key:, from:, to:, range:)
Nocturnal.timeline(from: from, to: to, range: range).map do |at|
Resource.new(key: key, range: range, at: at).values
end
end
|