Class: Crystal::Conveyors

Inherits:
Object show all
Defined in:
lib/crystal/conveyor/conveyors.rb

Instance Method Summary collapse

Constructor Details

#initializeConveyors

Returns a new instance of Conveyors.



4
5
6
# File 'lib/crystal/conveyor/conveyors.rb', line 4

def initialize
  @hash = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, &block) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/crystal/conveyor/conveyors.rb', line 12

def method_missing m, &block
  if block
    block.call self[m]
  else
    self[m]
  end
end

Instance Method Details

#[](conveyor_name) ⇒ Object



8
9
10
# File 'lib/crystal/conveyor/conveyors.rb', line 8

def [] conveyor_name
  @hash[conveyor_name.to_s] ||= Crystal::Conveyor.new
end