Great article! But a quick note, you don’t have to define a class method using a class name itself instead you can use self and no need to OrderDsl twice [Already commented on Github]

class OrdersDsl
def initialize
@orders = { to_perform: [], to_schedule: [] }.freeze
end
def parse(order_filename)
instance_eval File.read(order_filename)
end
privatedef order_now(order_name, *order_options)
@orders[:to_perform] << serialize_order(order_name, *order_options)
end
def schedule(order_name, *order_options)
@orders[:to_schedule] << serialize_order(order_name, *order_options)
end
def serialize_order(name, *options)
[name, *options]
end
def self.run(order_filename = 'Orders')
new.parse(order_filename)
end
end

∞ Travel | Coding | Lifestyle ⦿ Bangkok | ✧ #freelancer ▷ Got a project? ⭣ www.upwork.com/fl/al3rez

∞ Travel | Coding | Lifestyle ⦿ Bangkok | ✧ #freelancer ▷ Got a project? ⭣ www.upwork.com/fl/al3rez