Class: Evnt::HandlerGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Evnt::HandlerGenerator
- Defined in:
- lib/generators/evnt/handler_generator.rb
Overview
HandlerGenerator.
Instance Method Summary collapse
Instance Method Details
#create_handler ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# 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 ⇒ Object
26 27 28 29 30 31 |
# 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 |