Class: Reactive::NamedBaseGenerator

Inherits:
RubiGen::Base show all
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

Instance Method Summary collapse

Methods inherited from RubiGen::Base

#klass, use_plugin_sources!

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, runtime_options = {})
  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_nameObject (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_nestingObject (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

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/reactive-dev/named_base_generator.rb', line 16

def name
  @name
end

#pathObject (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

#pathnameObject (readonly)

complete pathname



22
23
24
# File 'lib/reactive-dev/named_base_generator.rb', line 22

def pathname
  @pathname
end

#plural_class_nameObject (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_nameObject (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_nameObject (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_nameObject (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_nameObject (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