Class: Lightning::Bolt::Cypher
- Inherits:
-
Object
- Object
- Lightning::Bolt::Cypher
- Defined in:
- lib/lightning/bolt/cypher.rb
Instance Method Summary collapse
- #arc(pin) ⇒ Object
- #bridge(dirname) ⇒ Object
-
#initialize(bookstore) ⇒ Cypher
constructor
A new instance of Cypher.
Constructor Details
#initialize(bookstore) ⇒ Cypher
Returns a new instance of Cypher.
5 6 7 8 9 |
# File 'lib/lightning/bolt/cypher.rb', line 5 def initialize(bookstore) @bookstore = bookstore @reports = [] bridge(@bookstore) end |
Instance Method Details
#arc(pin) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/lightning/bolt/cypher.rb', line 27 def arc(pin) value = "" @reports.each do | report | if report["key"].eql?(pin) data = report["cypher"] xrand = Xelor.hex(data.size) value = data[xrand] end end return value end |
#bridge(dirname) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lightning/bolt/cypher.rb', line 11 def bridge(dirname) data = '' Dir.foreach(dirname) do |dir| path = dirname + '/' + dir if File.directory?(path) then if dir != '.' && dir != '..' then data += bridge(path) end else capture(path) data += path end end return data end |