Class: FloorManager::Floor::DSL
- Inherits:
-
Object
- Object
- FloorManager::Floor::DSL
- Defined in:
- lib/floor_manager/floor.rb
Instance Method Summary collapse
- #any(name, opts = {}, &block) ⇒ Object
-
#initialize(options, &block) ⇒ DSL
constructor
A new instance of DSL.
- #object ⇒ Object
- #one(name, opts = {}, &block) ⇒ Object
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(, &block) @namespace = [: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 |
#object ⇒ Object
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 |