Class: Reactive::NamedBaseGenerator
- Inherits:
-
RubiGen::Base
- Object
- RubiGen::Base
- Reactive::NamedBaseGenerator
- Defined in:
- lib/reactive-dev/named_base_generator.rb
Overview
The base generator for named components: models, controllers, etc. The target name is taken as the first argument and inflected to several forms, see the attributes below..
If no name is provided, the generator raises a usage error with content optionally read from the USAGE file in the generator’s base path.
For example, the controller
generator takes the first argument as the name of the class and subsequent arguments as the names of actions to be generated:
./script/generate controller Article index new create
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#class_nesting ⇒ Object
readonly
these are arrays containing parts (path parts and module parts respectively).
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
these are arrays containing parts (path parts and module parts respectively).
-
#pathname ⇒ Object
readonly
complete pathname.
-
#plural_class_name ⇒ Object
readonly
Returns the value of attribute plural_class_name.
-
#plural_name ⇒ Object
readonly
Returns the value of attribute plural_name.
-
#singular_class_name ⇒ Object
readonly
Returns the value of attribute singular_class_name.
-
#singular_name ⇒ Object
readonly
Returns the value of attribute singular_name.
-
#underscore_name ⇒ Object
readonly
Returns the value of attribute underscore_name.
Instance Method Summary collapse
-
#initialize(runtime_args, runtime_options = {}) ⇒ NamedBaseGenerator
constructor
A new instance of NamedBaseGenerator.
Methods inherited from RubiGen::Base
Constructor Details
#initialize(runtime_args, runtime_options = {}) ⇒ NamedBaseGenerator
Returns a new instance of NamedBaseGenerator.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/reactive-dev/named_base_generator.rb', line 24 def initialize(runtime_args, = {}) super # Name argument is required. usage if runtime_args.empty? @args = runtime_args.dup assign_names!(@args.shift) self.class.use_plugin_sources! [:reactive, :test_unit] end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
16 17 18 |
# File 'lib/reactive-dev/named_base_generator.rb', line 16 def class_name @class_name end |
#class_nesting ⇒ Object (readonly)
these are arrays containing parts (path parts and module parts respectively)
19 20 21 |
# File 'lib/reactive-dev/named_base_generator.rb', line 19 def class_nesting @class_nesting end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/reactive-dev/named_base_generator.rb', line 16 def name @name end |
#path ⇒ Object (readonly)
these are arrays containing parts (path parts and module parts respectively)
19 20 21 |
# File 'lib/reactive-dev/named_base_generator.rb', line 19 def path @path end |
#pathname ⇒ Object (readonly)
complete pathname
22 23 24 |
# File 'lib/reactive-dev/named_base_generator.rb', line 22 def pathname @pathname end |
#plural_class_name ⇒ Object (readonly)
Returns the value of attribute plural_class_name.
16 17 18 |
# File 'lib/reactive-dev/named_base_generator.rb', line 16 def plural_class_name @plural_class_name end |
#plural_name ⇒ Object (readonly)
Returns the value of attribute plural_name.
16 17 18 |
# File 'lib/reactive-dev/named_base_generator.rb', line 16 def plural_name @plural_name end |
#singular_class_name ⇒ Object (readonly)
Returns the value of attribute singular_class_name.
16 17 18 |
# File 'lib/reactive-dev/named_base_generator.rb', line 16 def singular_class_name @singular_class_name end |
#singular_name ⇒ Object (readonly)
Returns the value of attribute singular_name.
16 17 18 |
# File 'lib/reactive-dev/named_base_generator.rb', line 16 def singular_name @singular_name end |
#underscore_name ⇒ Object (readonly)
Returns the value of attribute underscore_name.
16 17 18 |
# File 'lib/reactive-dev/named_base_generator.rb', line 16 def underscore_name @underscore_name end |