class Orientdb::RecordId
Attributes
cluster[RW]
position[RW]
Public Class Methods
new(rid=nil)
click to toggle source
# File lib/orientdb_binary/record_id.rb, line 7 def initialize(rid=nil) @cluster = nil @position = nil if rid.is_a? String and not rid.empty? parse_rid(rid) elsif rid.is_a? Orientdb::RecordId @cluster = rid.cluster @position = rid.position end end
Public Instance Methods
==(o)
click to toggle source
# File lib/orientdb_binary/record_id.rb, line 37 def ==(o) o.class == self.class && o.cluster == self.cluster && o.position == self.position end
Also aliased as: eql?
parse_rid(rid)
click to toggle source
# File lib/orientdb_binary/record_id.rb, line 18 def parse_rid(rid) match = rid.match(/^[#]?(?<cluster>-?\d+):(?<position>-?\d+)$/) @cluster = match[:cluster].to_i @position = match[:position].to_i self end
temporary?()
click to toggle source
# File lib/orientdb_binary/record_id.rb, line 33 def temporary? @cluster < 0 end
to_s()
click to toggle source
# File lib/orientdb_binary/record_id.rb, line 25 def to_s unless cluster && position "nil" else "##{cluster}:#{position}" end end