Class: Embryo::RubyTemplate::Model
- Inherits:
-
Object
- Object
- Embryo::RubyTemplate::Model
- Defined in:
- lib/rails-embryo/ruby_template/model.rb
Instance Method Summary collapse
- #class_name ⇒ Object
-
#initialize(name) ⇒ Model
constructor
A new instance of Model.
- #path ⇒ Object
- #plural ⇒ Object
- #plural_class_name ⇒ Object
- #plural_path ⇒ Object
- #plural_symbol ⇒ Object
- #singular ⇒ Object
- #symbol ⇒ Object
Constructor Details
#initialize(name) ⇒ Model
Returns a new instance of Model.
6 7 8 |
# File 'lib/rails-embryo/ruby_template/model.rb', line 6 def initialize(name) @name = name.singularize end |
Instance Method Details
#class_name ⇒ Object
26 27 28 |
# File 'lib/rails-embryo/ruby_template/model.rb', line 26 def class_name @name.camelize end |
#path ⇒ Object
10 11 12 |
# File 'lib/rails-embryo/ruby_template/model.rb', line 10 def path @name.underscore end |
#plural ⇒ Object
22 23 24 |
# File 'lib/rails-embryo/ruby_template/model.rb', line 22 def plural singular.pluralize end |
#plural_class_name ⇒ Object
30 31 32 |
# File 'lib/rails-embryo/ruby_template/model.rb', line 30 def plural_class_name class_name.pluralize end |
#plural_path ⇒ Object
14 15 16 |
# File 'lib/rails-embryo/ruby_template/model.rb', line 14 def plural_path path.pluralize end |
#plural_symbol ⇒ Object
38 39 40 |
# File 'lib/rails-embryo/ruby_template/model.rb', line 38 def plural_symbol symbol.pluralize end |
#singular ⇒ Object
18 19 20 |
# File 'lib/rails-embryo/ruby_template/model.rb', line 18 def singular path.split("/").last end |
#symbol ⇒ Object
34 35 36 |
# File 'lib/rails-embryo/ruby_template/model.rb', line 34 def symbol path.gsub("/", "_") end |