Oh, I forgot normally I use a moduleto create runnable/callable classes like below

# frozen_string_literal: truemodule Runnable
def self.included(klass)
klass.extend(ClassMethods)
end
module ClassMethods
def run(*args)
new(*args).run
end
end
end
# For example; OrderDsl
class OrderDsl
include Runnable

def initialize
@orders = { to_perform: [], to_schedule: [] }.freeze
end
def parse
end

# ...
def run(order_filename = 'Orders')
parse(order_filename)
end

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store