Class: Hanami::Commands::Generate::Abstract

Inherits:
Command
  • Object
show all
Includes:
Generators::Generatable
Defined in:
lib/hanami/commands/generate/abstract.rb

Direct Known Subclasses

Action, App, Mailer, Migration, Model

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Generators::Generatable

#add_mapping, #argument_blank?, #destroy, #generator, #map_templates, #post_process_templates, #process_templates, #start, #template_options

Methods inherited from Command

inherited

Constructor Details

#initialize(options) ⇒ Abstract

Returns a new instance of Abstract.



18
19
20
21
22
23
24
25
# File 'lib/hanami/commands/generate/abstract.rb', line 18

def initialize(options)
  super

  @options = Hanami::Utils::Hash.new(options).symbolize!
  assert_options!

  @target_path = Hanami.root
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



16
17
18
# File 'lib/hanami/commands/generate/abstract.rb', line 16

def options
  @options
end

#target_pathObject (readonly)

Returns the value of attribute target_path.



16
17
18
# File 'lib/hanami/commands/generate/abstract.rb', line 16

def target_path
  @target_path
end

Instance Method Details

#template_source_pathObject



27
28
29
30
# File 'lib/hanami/commands/generate/abstract.rb', line 27

def template_source_path
  generator = self.class.name.split('::').last.downcase
  Pathname.new(::File.dirname(__FILE__) + "/../../generators/#{generator}/").realpath
end