rubyx/lib/slot_language/slot_maker.rb

25 lines
405 B
Ruby
Raw Normal View History

2019-10-04 16:38:51 +02:00
module SlotLanguage
class SlotMaker
2019-10-07 19:14:40 +02:00
attr_reader :leaps
2019-10-07 19:14:40 +02:00
def initialize(leaps)
case leaps
when Array
@leaps = leaps
when nil
raise "No leaps given"
else
2019-10-07 19:14:40 +02:00
@leaps = [leaps]
end
end
def add_slot_name(name)
2019-10-07 19:14:40 +02:00
@leaps << name
end
def slot_def(compiler)
SlotMachine::SlotDefinition.new(:message , leaps)
2019-10-04 16:38:51 +02:00
end
end
end