Class: ThemedGenerator

Inherits:
Rails::Generator::NamedBase
  • Object
show all
Defined in:
lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runtime_args, runtime_options = {}) ⇒ ThemedGenerator

Returns a new instance of ThemedGenerator.



16
17
18
19
20
# File 'lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb', line 16

def initialize(runtime_args, runtime_options = {})
  super
  @controller_path  = runtime_args.shift
  @model_name       = runtime_args.shift   
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



8
9
10
# File 'lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb', line 8

def columns
  @columns
end

#controller_routing_pathObject (readonly)

Returns the value of attribute controller_routing_path.



8
9
10
# File 'lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb', line 8

def controller_routing_path
  @controller_routing_path
end

#model_nameObject (readonly)

Returns the value of attribute model_name.



8
9
10
# File 'lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb', line 8

def model_name
  @model_name
end

#plural_model_nameObject (readonly)

Returns the value of attribute plural_model_name.



8
9
10
# File 'lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb', line 8

def plural_model_name
  @plural_model_name
end

#plural_resource_nameObject (readonly)

Returns the value of attribute plural_resource_name.



8
9
10
# File 'lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb', line 8

def plural_resource_name
  @plural_resource_name
end

#resource_nameObject (readonly)

Returns the value of attribute resource_name.



8
9
10
# File 'lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb', line 8

def resource_name
  @resource_name
end

#singular_controller_routing_pathObject (readonly)

Returns the value of attribute singular_controller_routing_path.



8
9
10
# File 'lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb', line 8

def singular_controller_routing_path
  @singular_controller_routing_path
end

Instance Method Details

#manifestObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb', line 22

def manifest
  @controller_routing_path          = @table_name    
  @singular_controller_routing_path = @table_name.singularize    
  base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_path)    
  @model_name = base_name.singularize unless @model_name
  
  # Post
  @model_name           = @model_name.camelize 
  # Posts
  @plural_model_name    = @model_name.pluralize
  # post 
  @resource_name        = @model_name.downcase 
  # posts
  @plural_resource_name = @resource_name.pluralize                

  manifest_method = "manifest_for_#{options[:themed_type]}"    
  record do |m|
    send(manifest_method, m) if respond_to?(manifest_method)
  end
end