class Evnt::CommandGenerator

CommandGenerator.

Public Instance Methods

command_path() click to toggle source
# File lib/generators/evnt/command_generator.rb, line 29
def command_path
  path = './app/commands'
  @command_modules.map { |m| path = "#{path}/#{m.underscore}" }
  path = "#{path}/#{@command_class.underscore}.rb"
  path
end
create_comand() click to toggle source
# File lib/generators/evnt/command_generator.rb, line 14
def create_comand
  path = informations.first.split('::')
  @command_class = path.last.camelize
  @command_modules = path - [path.last]
  @command_params = (informations - [informations.first]).map do |data|
    data = data.split(':')
    data.length > 1 ? ":#{data.first}, type: :#{data.last}" : ":#{data.first}"
  end

  template(
    './command/command.rb.erb',
    command_path
  )
end