Class: Relaxo::Model::Properties::Optional
- Inherits:
-
Object
- Object
- Relaxo::Model::Properties::Optional
- Defined in:
- lib/relaxo/model/properties/attribute.rb
Class Method Summary collapse
Instance Method Summary collapse
- #convert_from_primative(database, value) ⇒ Object
- #convert_to_primative(value) ⇒ Object
-
#initialize(klass) ⇒ Optional
constructor
A new instance of Optional.
Constructor Details
#initialize(klass) ⇒ Optional
Returns a new instance of Optional.
76 77 78 |
# File 'lib/relaxo/model/properties/attribute.rb', line 76 def initialize(klass) @klass = klass end |
Class Method Details
.[](klass) ⇒ Object
72 73 74 |
# File 'lib/relaxo/model/properties/attribute.rb', line 72 def self.[] klass self.new(klass) end |
Instance Method Details
#convert_from_primative(database, value) ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/relaxo/model/properties/attribute.rb', line 88 def convert_from_primative(database, value) if value == nil || value.empty? nil else @klass.convert_from_primative(database, value) end end |
#convert_to_primative(value) ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/relaxo/model/properties/attribute.rb', line 80 def convert_to_primative(value) if value == nil || value == '' nil else @klass.convert_to_primative(value) end end |