Class: Azeroth::Model Private
- Inherits:
-
Object
- Object
- Azeroth::Model
- Defined in:
- lib/azeroth/model.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Model responsible for making the conection to the resource model class
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
private
Returns the name of the resource represented by the model.
Instance Method Summary collapse
-
#initialize(name) ⇒ Model
constructor
private
A new instance of Model.
-
#klass ⇒ Class
private
Resource class (real model class).
-
#plural ⇒ String
private
Return the pluralized version of resource name.
Constructor Details
#initialize(name) ⇒ Model
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Model.
18 19 20 |
# File 'lib/azeroth/model.rb', line 18 def initialize(name) @name = name.to_s end |
Instance Attribute Details
#name ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the name of the resource represented by the model
10 11 12 |
# File 'lib/azeroth/model.rb', line 10 def name @name end |
Instance Method Details
#klass ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resource class (real model class)
25 26 27 |
# File 'lib/azeroth/model.rb', line 25 def klass @klass ||= name.camelize.constantize end |
#plural ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the pluralized version of resource name
32 33 34 |
# File 'lib/azeroth/model.rb', line 32 def plural name.pluralize end |