class Ruboty::CommandBuilder
Attributes
arguments[R]
Public Class Methods
new(arguments = ARGV)
click to toggle source
# File lib/ruboty/command_builder.rb, line 7 def initialize(arguments = ARGV) @arguments = arguments end
Public Instance Methods
build()
click to toggle source
# File lib/ruboty/command_builder.rb, line 11 def build command_class.new(options) end
Private Instance Methods
command_class()
click to toggle source
# File lib/ruboty/command_builder.rb, line 17 def command_class case when options[:generate] Commands::Generate when options[:help] Commands::Help else Commands::Run end end
options()
click to toggle source
# File lib/ruboty/command_builder.rb, line 28 def options Slop.parse(arguments) do |options| options.on("--daemon", "Run as a daemon.") options.on("--dotenv", "Load .env before running.") options.on("-g", "--generate", "Generate a new chatterbot with ./ruboty/ directory if specified.") options.on("-h", "--help", "Display this help message.") if Slop::VERSION >= "4.0.0" options.string("-l", "--load", "Load a ruby file before running.") options.string("--pid", "Write the PID to a file.") else options.on("-l", "--load=", "Load a ruby file before running.") options.on("--pid=", "Write the PID to a file.") end end end