Class: BPM::Generator
- Inherits:
-
Object
- Object
- BPM::Generator
- Includes:
- Thor::Actions
- Defined in:
- lib/bpm/generator.rb
Overview
Knows how to generate items out of the local templates directory
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
Instance Method Summary collapse
- #dir_name ⇒ Object
-
#initialize(thor, name, root, template_path = nil, package = nil) ⇒ Generator
constructor
A new instance of Generator.
- #say(*args) ⇒ Object
- #shell ⇒ Object
- #source_paths ⇒ Object
Constructor Details
#initialize(thor, name, root, template_path = nil, package = nil) ⇒ Generator
Returns a new instance of Generator.
34 35 36 37 38 |
# File 'lib/bpm/generator.rb', line 34 def initialize(thor, name, root, template_path=nil, package=nil) @thor, @name, @template_path, @package = thor, name, template_path, package self.destination_root = root end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &blk) ⇒ Object (private)
70 71 72 |
# File 'lib/bpm/generator.rb', line 70 def method_missing(name, *args, &blk) @thor.send(name, *args, &blk) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/bpm/generator.rb', line 32 def name @name end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
32 33 34 |
# File 'lib/bpm/generator.rb', line 32 def package @package end |
Instance Method Details
#dir_name ⇒ Object
40 41 42 |
# File 'lib/bpm/generator.rb', line 40 def dir_name File.basename destination_root end |
#say(*args) ⇒ Object
52 53 54 |
# File 'lib/bpm/generator.rb', line 52 def say(*args) shell.say *args end |
#shell ⇒ Object
48 49 50 |
# File 'lib/bpm/generator.rb', line 48 def shell @shell ||= Thor::Base.shell.new end |
#source_paths ⇒ Object
44 45 46 |
# File 'lib/bpm/generator.rb', line 44 def source_paths [@template_path, self.class.source_root].compact end |