class Detroit::Assembly
An assembly is a set of production lines where each line is a list of named work stations.
Public Class Methods
new(name, &block)
click to toggle source
Calls superclass method
# File lib/detroit/assembly.rb, line 24 def initialize(name, &block) Detroit.assemblies[name.to_s.downcase.to_sym] = self @lines = [] @tools = [] super(&block) #module_eval(&block) end
Public Instance Methods
find(station)
click to toggle source
Lookup a chain by a given stage name.
@return nothing.
# File lib/detroit/assembly.rb, line 49 def find(station) station = station.to_sym lines.find do |line| line.include?(station) end end
included(tool_class)
click to toggle source
When the tool chain is included into a class, register that class as a tool.
@return [void] The tool class.
# File lib/detroit/assembly.rb, line 70 def included(tool_class) register_tool(tool_class) unless @tools.include?(tool_class) end
line(*stations)
click to toggle source
Define a chain of named links.
# File lib/detroit/assembly.rb, line 41 def line(*stations) # TODO: raise error if stage already used ? self.lines << stations.map{ |s| s.to_sym } end
lines()
click to toggle source
Returns a list of lists of stops.
@return [Array<Array<Symbol>>] lines.
# File lib/detroit/assembly.rb, line 36 def lines @lines end
register_tool(tool_class)
click to toggle source
Add tool to toolchain.
@return [Class] The tool class.
# File lib/detroit/assembly.rb, line 60 def register_tool(tool_class) tool_class.assembly = self @tools << tool_class Detroit.register_tool(tool_class) end