Class: Schematic::Generator::Names
- Inherits:
-
Object
- Object
- Schematic::Generator::Names
- Defined in:
- lib/schematic/generator/names.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#root ⇒ Object
Returns the value of attribute root.
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.
6 7 8 |
# File 'lib/schematic/generator/names.rb', line 6 def initialize(klass) @klass = klass end |
Instance Attribute Details
#klass ⇒ Object
Returns the value of attribute klass.
4 5 6 |
# File 'lib/schematic/generator/names.rb', line 4 def klass @klass end |
#root ⇒ Object
Returns the value of attribute root.
4 5 6 |
# File 'lib/schematic/generator/names.rb', line 4 def root @root end |
Instance Method Details
#collection_type ⇒ Object
22 23 24 |
# File 'lib/schematic/generator/names.rb', line 22 def collection_type type.pluralize end |
#element ⇒ Object
14 15 16 |
# File 'lib/schematic/generator/names.rb', line 14 def element element_name end |
#element_collection ⇒ Object
18 19 20 |
# File 'lib/schematic/generator/names.rb', line 18 def element_collection element_name.pluralize end |
#nested_attribute_name ⇒ Object
26 27 28 |
# File 'lib/schematic/generator/names.rb', line 26 def nested_attribute_name "#{element_collection}-attributes" end |
#type ⇒ Object
10 11 12 |
# File 'lib/schematic/generator/names.rb', line 10 def type @klass.name.gsub(/::/,'') end |