Class: Schematic::Generator::Names

Inherits:
Object
  • Object
show all
Defined in:
lib/schematic/generator/names.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Names

Returns a new instance of Names.



5
6
7
# File 'lib/schematic/generator/names.rb', line 5

def initialize(klass)
  @klass = klass
end

Instance Method Details

#collection_typeObject



21
22
23
# File 'lib/schematic/generator/names.rb', line 21

def collection_type
  type.pluralize
end

#elementObject



13
14
15
# File 'lib/schematic/generator/names.rb', line 13

def element
  type.underscore.dasherize
end

#element_collectionObject



17
18
19
# File 'lib/schematic/generator/names.rb', line 17

def element_collection
  element.pluralize
end

#nested_attribute_nameObject



25
26
27
# File 'lib/schematic/generator/names.rb', line 25

def nested_attribute_name
  "#{element_collection}-attributes"
end

#typeObject



9
10
11
# File 'lib/schematic/generator/names.rb', line 9

def type
  @klass.name.gsub(/::/,'')
end