Class: Merb::Generators::NamespacedGenerator

Inherits:
NamedGenerator show all
Defined in:
lib/merb-gen/namespaced_generator.rb

Instance Method Summary collapse

Methods inherited from NamedGenerator

#initialize, #symbol_name, #test_class_name

Methods inherited from Generator

#go_up, #initialize, source_root, #with_modules

Methods included from ColorfulMessages

#error, #success, #warning

Constructor Details

This class inherits a constructor from Merb::Generators::NamedGenerator

Instance Method Details

#base_pathObject



30
31
32
# File 'lib/merb-gen/namespaced_generator.rb', line 30

def base_path
  File.join(*snake_cased_chunks[0..-2])
end

#class_nameObject Also known as: module_name



14
15
16
# File 'lib/merb-gen/namespaced_generator.rb', line 14

def class_name
  chunks.last.gsub('-', '_').camel_case
end

#file_nameObject Also known as: base_name



20
21
22
# File 'lib/merb-gen/namespaced_generator.rb', line 20

def file_name
  chunks.last.snake_case
end

#full_class_nameObject



26
27
28
# File 'lib/merb-gen/namespaced_generator.rb', line 26

def full_class_name
  (modules + [class_name]).join('::')
end

#modulesObject



10
11
12
# File 'lib/merb-gen/namespaced_generator.rb', line 10

def modules
  chunks[0..-2]
end