Class: Resilience::ObjectTree

Inherits:
Object
  • Object
show all
Includes:
OnImage
Defined in:
lib/resilience/trees/object_tree.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OnImage

#image, image, included, restore_pos, #restore_pos, store_pos, #store_pos

Constructor Details

#initializeObjectTree

Returns a new instance of ObjectTree.



11
12
13
# File 'lib/resilience/trees/object_tree.rb', line 11

def initialize
  @map ||= {}
end

Instance Attribute Details

#mapObject

Returns the value of attribute map.



9
10
11
# File 'lib/resilience/trees/object_tree.rb', line 9

def map
  @map
end

Class Method Details

.parseObject



15
16
17
18
19
# File 'lib/resilience/trees/object_tree.rb', line 15

def self.parse
  tree = new
  tree.parse_entries
  tree
end

Instance Method Details

#pageObject

Depends on Image Pages extraction



22
23
24
# File 'lib/resilience/trees/object_tree.rb', line 22

def page
  image.pages.newest_for PAGES[:object_table]
end

#parse_entriesObject



26
27
28
29
30
31
32
33
# File 'lib/resilience/trees/object_tree.rb', line 26

def parse_entries
  page.attributes.each { |attr|
    obj1 = obj1_from attr
    obj2 = obj2_from attr
    @map[obj1] ||= []
    @map[obj1]  << obj2
  }
end