Class: StrokeDB::DocumentReferenceValue
- Defined in:
- lib/strokedb/document/slot.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#str ⇒ Object
(also: #to_raw, #to_s)
readonly
Returns the value of attribute str.
Instance Method Summary collapse
- #==(v) ⇒ Object
-
#initialize(str, doc, __cached_value = nil) ⇒ DocumentReferenceValue
constructor
A new instance of DocumentReferenceValue.
- #inspect ⇒ Object
- #load ⇒ Object
Methods inherited from String
#/, #blank?, #camel_case, #constantize, #demodulize, #ends_with?, #lines, #modulize, #plural, #singular, #snake_case, #stroke_diff, #stroke_merge, #stroke_patch, #tableize, #underscore, #unindent!
Constructor Details
#initialize(str, doc, __cached_value = nil) ⇒ DocumentReferenceValue
Returns a new instance of DocumentReferenceValue.
55 56 57 58 59 |
# File 'lib/strokedb/document/slot.rb', line 55 def initialize(str, doc, __cached_value = nil) @str, @doc = str, doc @cached_value = __cached_value super(str) end |
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
54 55 56 |
# File 'lib/strokedb/document/slot.rb', line 54 def doc @doc end |
#str ⇒ Object (readonly) Also known as: to_raw, to_s
Returns the value of attribute str.
53 54 55 |
# File 'lib/strokedb/document/slot.rb', line 53 def str @str end |
Instance Method Details
#==(v) ⇒ Object
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/strokedb/document/slot.rb', line 76 def ==(v) case v when DocumentReferenceValue v.str == str when Document v == self else str == v end end |
#inspect ⇒ Object
70 71 72 |
# File 'lib/strokedb/document/slot.rb', line 70 def inspect "#<DocRef #{self[0,5]}..>" end |
#load ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/strokedb/document/slot.rb', line 60 def load case self when VERSIONREF if doc.head? @cached_value || @cached_value = doc.store.find($1) || self else @cached_value || @cached_value = doc.store.find($1,$2) || self end end end |