Sha256: 04f332e61fc0b4e78b8babc5ebe1463ce6229a560b8bd67e75bbf0cb0201594e

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

#coding: utf-8
require 'fileutils'

class EventMachineGenerator < Rails::Generators::Base

  source_root File.expand_path('../templates', __FILE__)

  argument :this_event_name, :type => :string
  argument :controller_name, :type => :string
  argument :action_name, :type => :string

  def generate_event
    template "event.rb", "events/#{parsed_event_name}_event.rb"
    template "functional_test.rb", "test/functional/events/#{parsed_event_name}_test.rb"
  end

  private

  def parsed_event_name
    this_event_name.underscore
  end

  def parsed_controller_name
    controller_name.camelize
  end

  def parsed_action_name 
    action_name.underscore
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
event_machine-0.3.1 generators/event_machine/event_machine_generator.rb