Class: Solanum::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/solanum/source.rb

Direct Known Subclasses

Certificate, Cpu, Diskstats, Load, Memory, Network, Uptime

Defined Under Namespace

Classes: Certificate, Cpu, Diskstats, Load, Memory, Network, Uptime

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/solanum/source.rb', line 3

def attributes
  @attributes
end

#periodObject (readonly)

Returns the value of attribute period.



3
4
5
# File 'lib/solanum/source.rb', line 3

def period
  @period
end

#typeObject (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