Class: KeepYourHead::Database::Flashcard
Instance Attribute Summary
#file, #node
Class Method Summary
collapse
Instance Method Summary
collapse
#database, #initialize, my_define_method, #objectFromNode, #parent
addAttribute, addElementCData, addElementText, #xmlAccessorAttributeRead, #xmlAccessorAttributeWrite, #xmlAccessorElementCDataRead, #xmlAccessorElementCDataWrite, #xmlAccessorElementListCreate, #xmlAccessorElementListInsertAfter, #xmlAccessorElementListInsertBefore, #xmlAccessorElementListInsertFirst, #xmlAccessorElementListInsertLast, #xmlAccessorElementListNext, #xmlAccessorElementListPrevious, #xmlAccessorElementListRead, #xmlAccessorElementListRemove, #xmlAccessorElementTextRead, #xmlAccessorElementTextWrite
Methods inherited from BaseItem
#children, #next, #parent, #previous, #remove
Class Method Details
.createNode(file) ⇒ Object
107
108
109
110
111
112
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 107
def self.createNode( file )
obj = Flashcard.new file, ::REXML::Element.new("flashcard")
obj.name = "neue Flashcard"
obj.style = "latex"
obj.node
end
|
Instance Method Details
#active? ⇒ Boolean
69
70
71
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 69
def active?
nextCheck <= Time.now
end
|
#collectFlashcards ⇒ Object
some functions defined on all database entities for iteration
39
40
41
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 39
def collectFlashcards
[self]
end
|
#collection ⇒ Object
82
83
84
85
86
87
88
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 82
def collection
ret = self
while ret and not ret.kind_of? Collection
ret = ret.parent
end
ret
end
|
#compileImage(type, options = {}) ⇒ Object
77
78
79
80
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 77
def compileImage(type, options = {})
styleInstance = file.style(self.style)
compilation = styleInstance.createImage(type, self, options )
end
|
#content(type, options = {}) ⇒ Object
73
74
75
76
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 73
def content(type, options = {})
styleInstance = file.style(self.style)
styleInstance.content(type, self, options)
end
|
#count ⇒ Object
43
44
45
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 43
def count
1
end
|
#countActive ⇒ Object
46
47
48
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 46
def countActive
active? ? 1 : 0
end
|
#countPassive ⇒ Object
49
50
51
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 49
def countPassive
active? ? 0 : 1
end
|
#distribution ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 53
def distribution
distribution = []
distribution[self.level] = 1
distribution
end
|
#removeStatistics ⇒ Object
61
62
63
64
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 61
def removeStatistics
self.level = 0
self.nextCheck = Time.new - 60
end
|
#topic ⇒ Object
90
91
92
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 90
def topic
parent && parent.class == Topic && parent
end
|
#topicNames ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/Keepyourhead/database/Flashcard.rb', line 93
def topicNames
topics = []
n = topic
while n do
topics << n.name
n = n.topic
end
topics = topics.reverse
topics
end
|