rubyx/lib/slot_language/slot_maker.rb
Torsten Rüger 24d7fe25da first steps to defining specialised slot classes
getting rid of the mess in SlotDefinition (wip)
2020-02-10 18:36:21 +07:00

29 lines
462 B
Ruby

module SlotLanguage
class SlotMaker
attr_reader :leaps
def initialize(leaps)
case leaps
when Array
@leaps = leaps
when nil
raise "No leaps given"
else
@leaps = [leaps]
end
end
def add_slot_name(name)
@leaps << name
end
def slot_def(compiler)
SlotMachine::SlotDefinition.for(:message , leaps)
end
def to_s
"message." + leaps.join(",")
end
end
end