Class: Lightning::Bolt::Codex

Inherits:
Object
  • Object
show all
Defined in:
lib/lightning/bolt/codex.rb

Instance Method Summary collapse

Constructor Details

#initialize(bookstore, theorems, memory) ⇒ Codex

Returns a new instance of Codex.



10
11
12
13
14
15
16
17
18
# File 'lib/lightning/bolt/codex.rb', line 10

def initialize(bookstore, theorems, memory)
  @cypher = Lightning::Bolt::Cypher.new(bookstore)
  @fuzzer = Lightning::Bolt::Fuzzer.new('UTF-8')
  @keys = YAML.load_file("#{File.dirname(__FILE__)}/keys.yml")
  @passable = true
  @unique = false
  @theorems = theorems
  @memory = memory
end

Instance Method Details

#signal(passable, unique, name) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/lightning/bolt/codex.rb', line 20

def signal(passable, unique, name)
  @passable = passable.eql?(nil) ? true : passable
  @unique = unique.eql?(nil) ? false : unique
  path = nil
  @theorems.each do | theorem |
    if theorem["name"].eql?(name)
      path = theorem["path"]
    end
  end
  if path
    path = decrypt(path)
    path = rotar(path, @keys["keys"]["escapable"]) ? escapable(path) : path
    return path
  else
    return ""
  end
end