Class: Loveseat::Document::Property::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/loveseat/document/property/base.rb

Direct Known Subclasses

Array, Date, Float, Hash, Integer, Raw, String, Time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(default_value = nil) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/loveseat/document/property/base.rb', line 7

def initialize(default_value = nil)
  @value = cast(default_value)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/loveseat/document/property/base.rb', line 5

def value
  @value
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/loveseat/document/property/base.rb', line 19

def empty?
 @value.nil?
end

#getObject



11
12
13
# File 'lib/loveseat/document/property/base.rb', line 11

def get
  @value
end

#set(value) ⇒ Object



15
16
17
# File 'lib/loveseat/document/property/base.rb', line 15

def set(value)
  @value = cast(value)
end