Class: SecondStep::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/second_step/config.rb

Instance Method Summary collapse

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_pathObject



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_entropyObject



98
99
100
# File 'lib/second_step/config.rb', line 98

def phrase_entropy
  @phrase_entropy ||= Math.log2 phrase_possibility_count
end

#phrase_possibility_countObject



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_keyObject



107
108
109
# File 'lib/second_step/config.rb', line 107

def public_key
  rsa_key.public_key
end

#secondstep_pathObject



101
102
103
# File 'lib/second_step/config.rb', line 101

def secondstep_path
  path self.secondstep_uri
end

#word_list_countObject



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