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-05 18:37:24 +02:00
|
|
|
|
2019-10-07 19:14:40 +02:00
|
|
|
def initialize(leaps)
|
|
|
|
case leaps
|
|
|
|
when Array
|
|
|
|
@leaps = leaps
|
|
|
|
when nil
|
|
|
|
raise "No leaps given"
|
2019-10-05 18:37:24 +02:00
|
|
|
else
|
2019-10-07 19:14:40 +02:00
|
|
|
@leaps = [leaps]
|
2019-10-05 18:37:24 +02:00
|
|
|
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
|
2020-02-09 15:33:34 +01:00
|
|
|
|
|
|
|
def to_s
|
|
|
|
"message." + leaps.join(",")
|
|
|
|
end
|
2019-10-04 16:38:51 +02:00
|
|
|
end
|
|
|
|
end
|