Class: StrokeDB::Slot

Inherits:
Object show all
Defined in:
lib/strokedb/document/slot.rb

Constant Summary collapse

DUMP_PREFIX =
"@!Dump:".freeze
DUMP_PREFIX_RE =
/^#{DUMP_PREFIX}/.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc, name = nil) ⇒ Slot

Returns a new instance of Slot.



96
97
98
99
# File 'lib/strokedb/document/slot.rb', line 96

def initialize(doc, name = nil)
  @doc, @name = doc, name
  @decoded = {}
end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



91
92
93
# File 'lib/strokedb/document/slot.rb', line 91

def doc
  @doc
end

#nameObject (readonly)

Returns the value of attribute name.



91
92
93
# File 'lib/strokedb/document/slot.rb', line 91

def name
  @name
end

#valueObject

Returns the value of attribute value.



91
92
93
# File 'lib/strokedb/document/slot.rb', line 91

def value
  @value
end

Instance Method Details

#raw_value=(v) ⇒ Object



116
117
118
# File 'lib/strokedb/document/slot.rb', line 116

def raw_value=(v)
  self.value = decode_value(v)
end

#to_rawObject



110
111
112
# File 'lib/strokedb/document/slot.rb', line 110

def to_raw
  raw_value.to_optimized_raw
end