Class: World
- Inherits:
-
Object
- Object
- World
- Defined in:
- lib/asker/data/world.rb
Overview
World data
Instance Attribute Summary collapse
-
#concepts ⇒ Object
readonly
Returns the value of attribute concepts.
-
#contexts ⇒ Object
readonly
Returns the value of attribute contexts.
-
#filenames ⇒ Object
readonly
Returns the value of attribute filenames.
-
#image_urls ⇒ Object
readonly
Returns the value of attribute image_urls.
Instance Method Summary collapse
-
#find_neighbors_for_every_concept(concepts) ⇒ Object
For every concept…
-
#initialize(concepts, show_progress = true) ⇒ World
constructor
Initialize World object.
Constructor Details
#initialize(concepts, show_progress = true) ⇒ World
Initialize World object
16 17 18 19 20 |
# File 'lib/asker/data/world.rb', line 16 def initialize(concepts, show_progress = true) find_neighbors_for_every_concept(concepts) @concepts, @filenames, @contexts = get_lists_from(concepts) @image_urls = find_url_images_from_internet(show_progress) end |
Instance Attribute Details
#concepts ⇒ Object (readonly)
Returns the value of attribute concepts.
10 11 12 |
# File 'lib/asker/data/world.rb', line 10 def concepts @concepts end |
#contexts ⇒ Object (readonly)
Returns the value of attribute contexts.
10 11 12 |
# File 'lib/asker/data/world.rb', line 10 def contexts @contexts end |
#filenames ⇒ Object (readonly)
Returns the value of attribute filenames.
10 11 12 |
# File 'lib/asker/data/world.rb', line 10 def filenames @filenames end |
#image_urls ⇒ Object (readonly)
Returns the value of attribute image_urls.
10 11 12 |
# File 'lib/asker/data/world.rb', line 10 def image_urls @image_urls end |
Instance Method Details
#find_neighbors_for_every_concept(concepts) ⇒ Object
For every concept… find its neighbors
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/asker/data/world.rb', line 25 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 |