Class: World

Inherits:
Object
  • Object
show all
Defined in:
lib/asker/data/world.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(concepts, internet = true) ⇒ World

Returns a new instance of World.



9
10
11
12
13
# File 'lib/asker/data/world.rb', line 9

def initialize(concepts, internet = true)
  find_neighbors_for_every_concept(concepts)
  @concepts, @filenames, @contexts = get_lists_from(concepts)
  @image_urls = find_url_images_from_internet(internet)
end

Instance Attribute Details

#conceptsObject (readonly)

TODO: change how World class works ?



7
8
9
# File 'lib/asker/data/world.rb', line 7

def concepts
  @concepts
end

#contextsObject (readonly)

TODO: change how World class works ?



7
8
9
# File 'lib/asker/data/world.rb', line 7

def contexts
  @contexts
end

#filenamesObject (readonly)

TODO: change how World class works ?



7
8
9
# File 'lib/asker/data/world.rb', line 7

def filenames
  @filenames
end

#image_urlsObject (readonly)

TODO: change how World class works ?



7
8
9
# File 'lib/asker/data/world.rb', line 7

def image_urls
  @image_urls
end

Instance Method Details

#find_neighbors_for_every_concept(concepts) ⇒ Object

For every concept… find its neighbors

Parameters:

  • concepts (Array)


18
19
20
21
22
23
24
25
26
27
# File 'lib/asker/data/world.rb', line 18

def find_neighbors_for_every_concept(concepts)
  concepts.each do |i|
    concepts.each do |j|
      if i.id != j.id
        i.try_adding_neighbor(j)
        i.try_adding_references(j)
      end
    end
  end
end