Class: Trifle::Stats::Operations::Status::Scan
- Inherits:
-
Object
- Object
- Trifle::Stats::Operations::Status::Scan
- Defined in:
- lib/trifle/stats/operations/status/scan.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #config ⇒ Object
- #data ⇒ Object
-
#initialize(**keywords) ⇒ Scan
constructor
A new instance of Scan.
- #perform ⇒ Object
Constructor Details
#initialize(**keywords) ⇒ Scan
Returns a new instance of Scan.
10 11 12 13 |
# File 'lib/trifle/stats/operations/status/scan.rb', line 10 def initialize(**keywords) @key = keywords.fetch(:key) @config = keywords[:config] end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/trifle/stats/operations/status/scan.rb', line 8 def key @key end |
Instance Method Details
#config ⇒ Object
15 16 17 |
# File 'lib/trifle/stats/operations/status/scan.rb', line 15 def config @config || Trifle::Stats.default end |
#data ⇒ Object
19 20 21 22 23 |
# File 'lib/trifle/stats/operations/status/scan.rb', line 19 def data @data ||= config.driver.scan( key: Nocturnal::Key.new(key: key) ) end |
#perform ⇒ Object
25 26 27 28 29 30 |
# File 'lib/trifle/stats/operations/status/scan.rb', line 25 def perform { at: data.first, values: data.last } end |