Class: Solanum::Source
- Inherits:
-
Object
- Object
- Solanum::Source
- Defined in:
- lib/solanum/source.rb
Defined Under Namespace
Classes: Certificate, Cpu, Diskstats, Load, Memory, Network, Uptime
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#period ⇒ Object
readonly
Returns the value of attribute period.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #collect! ⇒ Object
-
#initialize(opts) ⇒ Source
constructor
A new instance of Source.
- #next_run(from = Time.now) ⇒ Object
Constructor Details
#initialize(opts) ⇒ Source
Returns a new instance of Source.
5 6 7 8 9 |
# File 'lib/solanum/source.rb', line 5 def initialize(opts) @type = opts['type'] @period = (opts['period'] || 10).to_i @attributes = opts['attributes'] end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/solanum/source.rb', line 3 def attributes @attributes end |
#period ⇒ Object (readonly)
Returns the value of attribute period.
3 4 5 |
# File 'lib/solanum/source.rb', line 3 def period @period end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/solanum/source.rb', line 3 def type @type end |
Instance Method Details
#collect! ⇒ Object
12 13 14 |
# File 'lib/solanum/source.rb', line 12 def collect! raise "Not Yet Implemented" end |
#next_run(from = Time.now) ⇒ Object
17 18 19 20 |
# File 'lib/solanum/source.rb', line 17 def next_run(from=Time.now) jitter = 0.95 + 0.10*rand from + jitter*@period end |