Class: Tablescript::Library

Inherits:
Object
  • Object
show all
Defined in:
lib/tablescript/library.rb

Overview

Library

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLibrary

Returns a new instance of Library.



25
26
27
# File 'lib/tablescript/library.rb', line 25

def initialize
  @root = Namespace.new
end

Class Attribute Details

.instanceObject



36
37
38
# File 'lib/tablescript/library.rb', line 36

def self.instance
  @instance ||= Library.new
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



23
24
25
# File 'lib/tablescript/library.rb', line 23

def root
  @root
end

Instance Method Details

#table(path) ⇒ Object



29
30
31
32
33
34
# File 'lib/tablescript/library.rb', line 29

def table(path)
  parts = path.split('/')
  return @root.resolve(path) if parts.size == 1
  return @root.resolve(parts[1..-1].join('/')) if parts[0].empty?
  @root.resolve(path)
end