Class: NamespaceEngine
- Inherits:
-
Object
- Object
- NamespaceEngine
- Defined in:
- lib/rails_namespace_engine.rb
Instance Attribute Summary collapse
-
#engine_name ⇒ Object
readonly
Returns the value of attribute engine_name.
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(argv) ⇒ NamespaceEngine
constructor
A new instance of NamespaceEngine.
Constructor Details
#initialize(argv) ⇒ NamespaceEngine
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rails_namespace_engine.rb', line 8 def initialize(argv) argv[0] = '--help' if argv.size < 2 if argv[0] == '--help' @help = true else @help = false @namespace = argv[0].underscore @engine_name = argv[1].underscore end end |
Instance Attribute Details
#engine_name ⇒ Object (readonly)
Returns the value of attribute engine_name.
6 7 8 |
# File 'lib/rails_namespace_engine.rb', line 6 def engine_name @engine_name end |
#help ⇒ Object (readonly)
Returns the value of attribute help.
6 7 8 |
# File 'lib/rails_namespace_engine.rb', line 6 def help @help end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
6 7 8 |
# File 'lib/rails_namespace_engine.rb', line 6 def namespace @namespace end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/rails_namespace_engine.rb', line 20 def call if help puts instructions else invoke_generator structure_files_and_directories file_contents end end |