class Ellen::CommandBuilder

Attributes

arguments[R]

Public Class Methods

new(arguments = ARGV) click to toggle source
# File lib/ellen/command_builder.rb, line 7
def initialize(arguments = ARGV)
  @arguments = arguments
end

Public Instance Methods

build() click to toggle source
# File lib/ellen/command_builder.rb, line 11
def build
  command_class.new(options)
end

Private Instance Methods

command_class() click to toggle source
# File lib/ellen/command_builder.rb, line 17
def command_class
  options[:generate] ? Commands::Generate : Commands::Run
end
options() click to toggle source
# File lib/ellen/command_builder.rb, line 21
def options
  Slop.parse!(arguments, help: true) do
    on("dotenv", "Load .env before running.")
    on("g", "generate", "Generate a new chatterbot with ./ellen/ directory if specified.")
    on("l", "load=", "Load a ruby file before running.")
  end.to_hash
end