Class: SecondStep::Config
- Inherits:
-
Object
- Object
- SecondStep::Config
- Defined in:
- lib/second_step/config.rb
Instance Method Summary collapse
- #base_path ⇒ Object
-
#initialize(&block) ⇒ Config
constructor
A new instance of Config.
- #path(*args) ⇒ Object
- #phrase_entropy ⇒ Object
- #phrase_possibility_count ⇒ Object
- #public_key ⇒ Object
- #secondstep_path ⇒ Object
- #word_list_count ⇒ Object
Constructor Details
#initialize(&block) ⇒ Config
23 24 25 |
# File 'lib/second_step/config.rb', line 23 def initialize(&block) self.instance_eval(&block) end |
Instance Method Details
#base_path ⇒ Object
104 105 106 |
# File 'lib/second_step/config.rb', line 104 def base_path (@base_path ||= (secondstep_path + api_path).save!).new end |
#path(*args) ⇒ Object
49 50 51 |
# File 'lib/second_step/config.rb', line 49 def path(*args) PathBuilder.new(*args) end |
#phrase_entropy ⇒ Object
98 99 100 |
# File 'lib/second_step/config.rb', line 98 def phrase_entropy @phrase_entropy ||= Math.log2 phrase_possibility_count end |
#phrase_possibility_count ⇒ Object
95 96 97 |
# File 'lib/second_step/config.rb', line 95 def phrase_possibility_count @phrase_possibility_count ||= (word_list_count ** phrase_generator_length) * phrase_delimiters.length end |
#public_key ⇒ Object
107 108 109 |
# File 'lib/second_step/config.rb', line 107 def public_key rsa_key.public_key end |
#secondstep_path ⇒ Object
101 102 103 |
# File 'lib/second_step/config.rb', line 101 def secondstep_path path self.secondstep_uri end |
#word_list_count ⇒ Object
92 93 94 |
# File 'lib/second_step/config.rb', line 92 def word_list_count @word_list_count ||= `sed -n '$=' #{word_list_path}`.chomp.to_i end |