Class: Enumerations::Reflection
- Inherits:
-
Object
- Object
- Enumerations::Reflection
- Defined in:
- lib/enumerations/reflection.rb
Instance Attribute Summary collapse
-
#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
- #enumerator_class ⇒ Object
- #foreign_key ⇒ Object
-
#initialize(name, options = {}) ⇒ Reflection
constructor
A new instance of Reflection.
Constructor Details
#initialize(name, options = {}) ⇒ Reflection
Returns a new instance of Reflection.
5 6 7 8 |
# File 'lib/enumerations/reflection.rb', line 5 def initialize(name, = {}) @name = name @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/enumerations/reflection.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/enumerations/reflection.rb', line 3 def @options end |
Instance Method Details
#class_name ⇒ Object
10 11 12 |
# File 'lib/enumerations/reflection.rb', line 10 def class_name @class_name ||= ([:class_name] || name).to_s.camelize end |
#enumerator_class ⇒ Object
18 19 20 |
# File 'lib/enumerations/reflection.rb', line 18 def enumerator_class @enumerator_class ||= class_name.constantize end |
#foreign_key ⇒ Object
14 15 16 |
# File 'lib/enumerations/reflection.rb', line 14 def foreign_key @foreign_key ||= ([:foreign_key] || default_foreign_key_name).to_sym end |