Class: ToPass::Base
- Inherits:
-
Object
- Object
- ToPass::Base
- Defined in:
- lib/to_pass/base.rb
Overview
ToPass::Base is mostly a facade for the library.
Given a string and a algorithm identifier, the right rules are loaded and applied to the string. With a simple “to_s”, you can get the final password. The password is also readable directly through ToPass::Base#password.
see ToPass::AlgorithmReader and ToPass::Converter for details
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Instance Method Summary collapse
-
#initialize(string, algorithm, options = {}) ⇒ Base
constructor
transform a string according to a certain algorithm.
-
#to_s ⇒ Object
return the generated password.
Constructor Details
#initialize(string, algorithm, options = {}) ⇒ Base
transform a string according to a certain algorithm
16 17 18 19 20 21 |
# File 'lib/to_pass/base.rb', line 16 def initialize(string, algorithm, = {}) Directories[:custom] = [:path] if [:path] rules = AlgorithmReader.load(algorithm) converter = Converter.new(rules) @password = converter.convert(string) end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
13 14 15 |
# File 'lib/to_pass/base.rb', line 13 def password @password end |
Instance Method Details
#to_s ⇒ Object
return the generated password
24 25 26 |
# File 'lib/to_pass/base.rb', line 24 def to_s password end |