class Evnt::HandlerGenerator

HandlerGenerator.

Public Instance Methods

create_handler() click to toggle source
# File lib/generators/evnt/handler_generator.rb, line 14
def create_handler
  path = informations.first.split('::')
  @handler_class = path.last.camelize
  @handler_modules = path - [path.last]
  @handler_events = (informations - [informations.first])

  template(
    './handler/handler.rb.erb',
    handler_path
  )
end
handler_path() click to toggle source
# File lib/generators/evnt/handler_generator.rb, line 26
def handler_path
  path = './app/handlers'
  @handler_modules.map { |m| path = "#{path}/#{m.underscore}" }
  path = "#{path}/#{@handler_class.underscore}.rb"
  path
end