Class: Schematic::Generator::Names
- Inherits:
-
Object
- Object
- Schematic::Generator::Names
- Defined in:
- lib/schematic/generator/names.rb
Instance Method Summary collapse
- #collection_type ⇒ Object
- #element ⇒ Object
- #element_collection ⇒ Object
-
#initialize(klass) ⇒ Names
constructor
A new instance of Names.
- #nested_attribute_name ⇒ Object
- #type ⇒ Object
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_type ⇒ Object
21 22 23 |
# File 'lib/schematic/generator/names.rb', line 21 def collection_type type.pluralize end |
#element ⇒ Object
13 14 15 |
# File 'lib/schematic/generator/names.rb', line 13 def element type.underscore.dasherize end |
#element_collection ⇒ Object
17 18 19 |
# File 'lib/schematic/generator/names.rb', line 17 def element_collection element.pluralize end |
#nested_attribute_name ⇒ Object
25 26 27 |
# File 'lib/schematic/generator/names.rb', line 25 def nested_attribute_name "#{element_collection}-attributes" end |
#type ⇒ Object
9 10 11 |
# File 'lib/schematic/generator/names.rb', line 9 def type @klass.name.gsub(/::/,'') end |