Sha256: 68db2cbb19d97acc3c1e1b6316194d298d9c198ad44117c4b53fd012f122d87f

Contents?: true

Size: 617 Bytes

Versions: 3

Compression:

Stored size: 617 Bytes

Contents

module Controll
  module Generators
    class AssistantGenerator < ::Rails::Generators::NamedBase
      desc 'Generates an Assitant'
      
      class_option :delegate, type: :boolean, default: false

      def main_flow
        template "assistant.tt", "app/controll/assistants/#{file_name}.rb"
      end

      protected

      def delegate?
        options[:delegate]
      end

      def parent_class
        name.include?('::') ? "::Controll::#{parent_class_name}" : parent_class_name
      end

      def parent_class_name
        delegate? 'DelegateAssistant' : 'Assistant'        
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
controll-0.3.2 lib/generators/controll/assistant_generator.rb
controll-0.3.1 lib/generators/controll/assistant_generator.rb
controll-0.3.0 lib/generators/controll/assistant_generator.rb