Class: Falcore::Aggregator

Inherits:
Object
  • Object
show all
Defined in:
lib/falcore/aggregator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Aggregator

Returns a new instance of Aggregator.



26
27
28
# File 'lib/falcore/aggregator.rb', line 26

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



21
22
23
# File 'lib/falcore/aggregator.rb', line 21

def config
  @config
end

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/falcore/aggregator.rb', line 30

def run
  hash = Fetcher.get("#{config.jenkins.endpoint}/computer/api/json")

  master = Node::Master.new(hash['computer'][0])
  slaves = hash['computer'][1..-1].map do |slave|
    Node::Slave.new(master, slave)
  end

  master
end