Class: Muding::Generator::NamedBase
- Defined in:
- lib/muding_generator/base.rb
Overview
The base generator for named components: models, controllers, mailers, etc. The target name is taken as the first argument and inflected to singular, plural, class, file, and table forms for your convenience. The remaining arguments are aliased to actions for controller and mailer convenience.
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.
See Muding::Generator::Base for a discussion of Manifests and Commands.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#class_nesting ⇒ Object
readonly
Returns the value of attribute class_nesting.
-
#class_nesting_depth ⇒ Object
readonly
Returns the value of attribute class_nesting_depth.
-
#class_path ⇒ Object
readonly
Returns the value of attribute class_path.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#plural_name ⇒ Object
readonly
Returns the value of attribute plural_name.
-
#singular_name ⇒ Object
(also: #file_name)
readonly
Returns the value of attribute singular_name.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Attributes inherited from Base
#args, #destination_root, #source_root
Attributes included from Options
Instance Method Summary collapse
-
#initialize(runtime_args, runtime_options = {}) ⇒ NamedBase
constructor
A new instance of NamedBase.
Methods inherited from Base
#destination_path, #manifest, #source_path
Methods included from Options
Constructor Details
#initialize(runtime_args, runtime_options = {}) ⇒ NamedBase
Returns a new instance of NamedBase.
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/muding_generator/base.rb', line 111 def initialize(runtime_args, = {}) super # Name argument is required. usage if runtime_args.empty? @args = runtime_args.dup base_name = @args.shift assign_names!(base_name) end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
106 107 108 |
# File 'lib/muding_generator/base.rb', line 106 def class_name @class_name end |
#class_nesting ⇒ Object (readonly)
Returns the value of attribute class_nesting.
107 108 109 |
# File 'lib/muding_generator/base.rb', line 107 def class_nesting @class_nesting end |
#class_nesting_depth ⇒ Object (readonly)
Returns the value of attribute class_nesting_depth.
107 108 109 |
# File 'lib/muding_generator/base.rb', line 107 def class_nesting_depth @class_nesting_depth end |
#class_path ⇒ Object (readonly)
Returns the value of attribute class_path.
107 108 109 |
# File 'lib/muding_generator/base.rb', line 107 def class_path @class_path end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
107 108 109 |
# File 'lib/muding_generator/base.rb', line 107 def file_path @file_path end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
106 107 108 |
# File 'lib/muding_generator/base.rb', line 106 def name @name end |
#plural_name ⇒ Object (readonly)
Returns the value of attribute plural_name.
106 107 108 |
# File 'lib/muding_generator/base.rb', line 106 def plural_name @plural_name end |
#singular_name ⇒ Object (readonly) Also known as: file_name
Returns the value of attribute singular_name.
106 107 108 |
# File 'lib/muding_generator/base.rb', line 106 def singular_name @singular_name end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
106 107 108 |
# File 'lib/muding_generator/base.rb', line 106 def table_name @table_name end |