Class: StrokeDB::DocumentReferenceValue
- Defined in:
- lib/document/slot.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#str ⇒ Object
(also: #to_raw)
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?, #plural, #singular, #snake_case, #stroke_diff, #stroke_merge, #stroke_patch, #tableize
Constructor Details
#initialize(str, doc, __cached_value = nil) ⇒ DocumentReferenceValue
Returns a new instance of DocumentReferenceValue.
51 52 53 54 55 |
# File 'lib/document/slot.rb', line 51 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.
50 51 52 |
# File 'lib/document/slot.rb', line 50 def doc @doc end |
#str ⇒ Object (readonly) Also known as: to_raw
Returns the value of attribute str.
49 50 51 |
# File 'lib/document/slot.rb', line 49 def str @str end |
Instance Method Details
#==(v) ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/document/slot.rb', line 71 def ==(v) case v when DocumentReferenceValue v.str == str when Document v == self else str == v end end |
#inspect ⇒ Object
66 67 68 |
# File 'lib/document/slot.rb', line 66 def inspect "#<DocRef #{self[0,5]}..>" end |
#load ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/document/slot.rb', line 56 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 |