class Punchout::Fabricator
Public Class Methods
new(factory)
click to toggle source
# File lib/punchout/fabricator.rb, line 5 def initialize(factory) @puncher = Puncher.new @factory = factory end
Public Instance Methods
add(matchable)
click to toggle source
# File lib/punchout/fabricator.rb, line 10 def add(matchable) @puncher.add(matchable) end
can_punch?(type)
click to toggle source
# File lib/punchout/fabricator.rb, line 14 def can_punch?(type) true end
punch(type)
click to toggle source
# File lib/punchout/fabricator.rb, line 18 def punch(type) if @puncher.can_punch?(type) @puncher.punch(type) else matchable = @factory.build(type) @puncher.add(matchable) matchable.thing end end