Class: MachineGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/machine/machine_group.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ MachineGroup

:nodoc



3
4
5
6
# File 'lib/machine/machine_group.rb', line 3

def initialize(name, options={}) #:nodoc
  @name = name
  @options = options
end

Instance Method Details

#base(&block) ⇒ Object

:nodoc



8
9
10
11
# File 'lib/machine/machine_group.rb', line 8

def base(&block) #:nodoc
  @base_machine = Machine.new(@name, @options, block)
  Machine.machines[@name] = @base_machine
end

#define(name, &block) ⇒ Object

:nodoc



13
14
15
16
17
18
19
20
21
# File 'lib/machine/machine_group.rb', line 13

def define(name, &block) #:nodoc
  if @base_machine
    options = @options.merge(:extends => @name)
  else
    options = @options.merge(:class => (@options[:class] || @name.to_s.camelize.constantize))
  end
  machine = Machine.new(name, options, block)
  Machine.machines[name] = machine
end