Class: Sym::App::PrivateKey::Detector
- Defined in:
- lib/sym/app/private_key/detector.rb
Instance Attribute Summary collapse
-
#input_handler ⇒ Object
Returns the value of attribute input_handler.
-
#key ⇒ Object
Returns the value of attribute key.
-
#key_source ⇒ Object
Returns the value of attribute key_source.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#password_cache ⇒ Object
Returns the value of attribute password_cache.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Detector
constructor
A new instance of Detector.
- #read ⇒ Object
-
#read! ⇒ Object
Returns the first valid 32-bit key obtained by running the above procs on a given string.
Constructor Details
#initialize(*args) ⇒ Detector
Returns a new instance of Detector.
12 13 14 15 |
# File 'lib/sym/app/private_key/detector.rb', line 12 def initialize(*args) super(*args) read end |
Instance Attribute Details
#input_handler ⇒ Object
Returns the value of attribute input_handler
9 10 11 |
# File 'lib/sym/app/private_key/detector.rb', line 9 def input_handler @input_handler end |
#key ⇒ Object
Returns the value of attribute key.
10 11 12 |
# File 'lib/sym/app/private_key/detector.rb', line 10 def key @key end |
#key_source ⇒ Object
Returns the value of attribute key_source.
10 11 12 |
# File 'lib/sym/app/private_key/detector.rb', line 10 def key_source @key_source end |
#opts ⇒ Object
Returns the value of attribute opts
9 10 11 |
# File 'lib/sym/app/private_key/detector.rb', line 9 def opts @opts end |
#password_cache ⇒ Object
Returns the value of attribute password_cache
9 10 11 |
# File 'lib/sym/app/private_key/detector.rb', line 9 def password_cache @password_cache end |
Instance Method Details
#read ⇒ Object
17 18 19 20 |
# File 'lib/sym/app/private_key/detector.rb', line 17 def read return key if key self.key, self.key_source = read! end |
#read! ⇒ Object
Returns the first valid 32-bit key obtained by running the above procs on a given string.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sym/app/private_key/detector.rb', line 24 def read! KeySourceCheck::CHECKS.each do |source_check| next unless result = source_check.detect(self) rescue nil if key_ = normalize_key(result.key) key_source_ = result.to_s return key_, key_source_ end end nil end |