Class: Sheldon

Inherits:
Object
  • Object
show all
Defined in:
lib/sheldon/sheldon.rb

Constant Summary collapse

VERSION =
"6.2.2".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sheldon_data_dir) ⇒ Sheldon

Returns a new instance of Sheldon.



7
8
9
10
11
12
13
14
# File 'lib/sheldon/sheldon.rb', line 7

def initialize(sheldon_data_dir)
  unless Dir.exist?(sheldon_data_dir)
    raise MissingDataDirectoryException, "Directory #{sheldon_data_dir} does not exist."
  end

  @brain = Brain.new(sheldon_data_dir)
  @builder = Builder.new
end

Instance Attribute Details

#brainObject (readonly)

Returns the value of attribute brain.



5
6
7
# File 'lib/sheldon/sheldon.rb', line 5

def brain
  @brain
end

#builderObject (readonly)

Returns the value of attribute builder.



5
6
7
# File 'lib/sheldon/sheldon.rb', line 5

def builder
  @builder
end

Instance Method Details

#build(abs_learn_path) ⇒ Object



16
17
18
# File 'lib/sheldon/sheldon.rb', line 16

def build(abs_learn_path)
  builder.build(abs_learn_path)
end

#forget(recall_cue) ⇒ Object



20
21
22
# File 'lib/sheldon/sheldon.rb', line 20

def forget(recall_cue)
  brain.forget(recall_cue)
end

#learn(recall_cue, abs_learn_path) ⇒ Object



24
25
26
# File 'lib/sheldon/sheldon.rb', line 24

def learn(recall_cue, abs_learn_path)
  brain.learn(recall_cue, abs_learn_path)
end

#list_cuesObject



28
29
30
# File 'lib/sheldon/sheldon.rb', line 28

def list_cues
  brain.list_cues
end

#recall(recall_cue, opts = {}) ⇒ Object



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

def recall(recall_cue, opts={})
  brain.recall(recall_cue, opts)
end

#recalled?(recall_cue) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/sheldon/sheldon.rb', line 40

def recalled?(recall_cue)
  brain.recalled?(recall_cue)
end

#setup!Object



36
37
38
# File 'lib/sheldon/sheldon.rb', line 36

def setup!
  brain.memory.save!
end