Class: FloorManager::Floor::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/floor_manager/floor.rb

Instance Method Summary collapse

Constructor Details

#initialize(options, &block) ⇒ DSL

Returns a new instance of DSL.



8
9
10
11
12
# File 'lib/floor_manager/floor.rb', line 8

def initialize(options, &block)
  @namespace = options[:namespace] || nil
  @floor = FloorManager::Floor.new
  instance_eval(&block)
end

Instance Method Details

#any(name, opts = {}, &block) ⇒ Object



20
21
22
23
24
# File 'lib/floor_manager/floor.rb', line 20

def any(name, opts={}, &block)
  klass_name = opts[:class] || name
  @floor.employees[name.to_sym] = 
    FloorManager::Employee::Template.from_dsl(klass_name, @namespace, &block)
end

#objectObject



26
27
28
# File 'lib/floor_manager/floor.rb', line 26

def object
  @floor
end

#one(name, opts = {}, &block) ⇒ Object



14
15
16
17
18
# File 'lib/floor_manager/floor.rb', line 14

def one(name, opts={}, &block) 
  klass_name = opts[:class] || name
  @floor.employees[name.to_sym] = 
    FloorManager::Employee::Unique.from_dsl(klass_name, @namespace, &block)
end