Class: Concept
- Inherits:
-
Object
- Object
- Concept
- Defined in:
- lib/annlat/Concept.rb,
lib/annlat/Sundries.rb
Instance Attribute Summary collapse
-
#images ⇒ Object
Returns the value of attribute images.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
- #addImage(img) ⇒ Object
- #move_image(img) ⇒ Object
- #move_images ⇒ Object
- #showAnswer ⇒ Object
- #showHow ⇒ Object
- #showQuestion ⇒ Object
- #solve ⇒ Object
- #validate(attempt) ⇒ Object
- #variants ⇒ Object
Instance Attribute Details
#images ⇒ Object
Returns the value of attribute images.
31 32 33 |
# File 'lib/annlat/Sundries.rb', line 31 def images @images end |
#uuid ⇒ Object
Returns the value of attribute uuid.
32 33 34 |
# File 'lib/annlat/Sundries.rb', line 32 def uuid @uuid end |
Class Method Details
.name ⇒ Object
3 4 5 |
# File 'lib/annlat/Concept.rb', line 3 def self.name nil end |
.version ⇒ Object
7 8 9 |
# File 'lib/annlat/Concept.rb', line 7 def self.version 0 end |
.whichConcepts ⇒ Object
31 32 33 |
# File 'lib/annlat/Concept.rb', line 31 def self.whichConcepts nil end |
Instance Method Details
#addImage(img) ⇒ Object
65 66 67 68 69 |
# File 'lib/annlat/Sundries.rb', line 65 def addImage(img) @images=[] if @images.nil? raise "You tried to add not an image" if img.class!=Image @images << img end |
#move_image(img) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/annlat/Sundries.rb', line 35 def move_image(img) uuid=img.uuid path=img.path if !img.[:dynamic] begin FileUtils.mv("engine/concepts/#{path}", "public/images/#{self.class}/static/#{path}") rescue Errno::ENOENT end img.path = "#{self.class}/static/#{path}" else img.path= "#{self.class}/#{uuid}" FileUtils.mv("#{path}", "public/images/#{self.class}/#{uuid}") end img end |
#move_images ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/annlat/Sundries.rb', line 51 def move_images concept=self @images=[] if @images.nil? begin Dir.mkdir("public/images/#{self.class}") rescue Errno::EEXIST end begin Dir.mkdir("public/images/#{self.class}/static") rescue Errno::EEXIST end @images.map {|x| move_image(x)} end |
#showAnswer ⇒ Object
23 24 25 |
# File 'lib/annlat/Concept.rb', line 23 def showAnswer nil end |
#showHow ⇒ Object
27 28 29 |
# File 'lib/annlat/Concept.rb', line 27 def showHow nil end |
#showQuestion ⇒ Object
19 20 21 |
# File 'lib/annlat/Concept.rb', line 19 def showQuestion nil end |
#solve ⇒ Object
11 12 13 |
# File 'lib/annlat/Concept.rb', line 11 def solve nil end |
#validate(attempt) ⇒ Object
15 16 17 |
# File 'lib/annlat/Concept.rb', line 15 def validate(attempt) attempt.to_f == solve.to_f end |
#variants ⇒ Object
35 36 37 |
# File 'lib/annlat/Concept.rb', line 35 def variants nil end |