Class: CassandraObject::BelongsTo::Reflection
- Inherits:
-
Object
- Object
- CassandraObject::BelongsTo::Reflection
- Defined in:
- lib/cassandra_object/belongs_to/reflection.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #class_name ⇒ Object
- #foreign_key ⇒ Object
-
#initialize(model, name, options) ⇒ Reflection
constructor
A new instance of Reflection.
- #instance_variable_name ⇒ Object
- #polymorphic? ⇒ Boolean
- #polymorphic_column ⇒ Object
Constructor Details
#initialize(model, name, options) ⇒ Reflection
Returns a new instance of Reflection.
5 6 7 |
# File 'lib/cassandra_object/belongs_to/reflection.rb', line 5 def initialize(model, name, ) @model, @name, @options = model, name, end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
4 5 6 |
# File 'lib/cassandra_object/belongs_to/reflection.rb', line 4 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/cassandra_object/belongs_to/reflection.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/cassandra_object/belongs_to/reflection.rb', line 4 def @options end |
Instance Method Details
#class_name ⇒ Object
25 26 27 |
# File 'lib/cassandra_object/belongs_to/reflection.rb', line 25 def class_name [:class_name] || name.to_s.camelize end |
#foreign_key ⇒ Object
13 14 15 |
# File 'lib/cassandra_object/belongs_to/reflection.rb', line 13 def foreign_key "#{name}_id" end |
#instance_variable_name ⇒ Object
9 10 11 |
# File 'lib/cassandra_object/belongs_to/reflection.rb', line 9 def instance_variable_name "@#{name}" end |
#polymorphic? ⇒ Boolean
21 22 23 |
# File 'lib/cassandra_object/belongs_to/reflection.rb', line 21 def polymorphic? [:polymorphic] end |
#polymorphic_column ⇒ Object
17 18 19 |
# File 'lib/cassandra_object/belongs_to/reflection.rb', line 17 def polymorphic_column "#{name}_type" end |