Class: Concept

Inherits:
Object
  • Object
show all
Defined in:
lib/annlat/Concept.rb,
lib/annlat/Sundries.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#imagesObject

Returns the value of attribute images.



31
32
33
# File 'lib/annlat/Sundries.rb', line 31

def images
  @images
end

#uuidObject

Returns the value of attribute uuid.



32
33
34
# File 'lib/annlat/Sundries.rb', line 32

def uuid
  @uuid
end

Class Method Details

.nameObject



3
4
5
# File 'lib/annlat/Concept.rb', line 3

def self.name
  nil
end

.versionObject



7
8
9
# File 'lib/annlat/Concept.rb', line 7

def self.version
  0
end

.whichConceptsObject



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.options[: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_imagesObject



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

#showAnswerObject



23
24
25
# File 'lib/annlat/Concept.rb', line 23

def showAnswer
  nil
end

#showHowObject



27
28
29
# File 'lib/annlat/Concept.rb', line 27

def showHow
  nil
end

#showQuestionObject



19
20
21
# File 'lib/annlat/Concept.rb', line 19

def showQuestion
  nil 
end

#solveObject



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

#variantsObject



35
36
37
# File 'lib/annlat/Concept.rb', line 35

def variants
  nil
end