Sha256: 642cc81435e5cceda81b9e78301f51086a799b3e35f8bcce7604ef2e7aff09ed
Contents?: true
Size: 810 Bytes
Versions: 1
Compression:
Stored size: 810 Bytes
Contents
module Fable class Pointer attr_accessor :container, :index def self.start_of(container) self.new(container, 0) end def self.null_pointer self.new(nil, -1) end def initialize(container, index) self.container = container self.index = index end def resolve! return container if index < 0 return nil if container.nil? return container if container.content.empty? return container.content[index] end def clone self.class.new(self.container, self.index) end def null_pointer? container.nil? end def path return nil if null_pointer? if index > 0 return container.path.path_by_appending_component(index) else return container.path end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fable-0.5.0 | lib/fable/pointer.rb |