Class: PersonalWordlist::DSL::Sequence
- Inherits:
-
Object
- Object
- PersonalWordlist::DSL::Sequence
- Includes:
- PersonalWordlist::DSL
- Defined in:
- lib/personal_wordlist/dsl/sequence.rb
Overview
Creates sequences within given patterns
Instance Method Summary collapse
-
#initialize(personal_data, block, range) ⇒ Sequence
constructor
A new instance of Sequence.
- #run! ⇒ Object
Methods included from PersonalWordlist::DSL
#method_missing, #partial, #sequence
Constructor Details
#initialize(personal_data, block, range) ⇒ Sequence
Returns a new instance of Sequence.
7 8 9 10 11 12 |
# File 'lib/personal_wordlist/dsl/sequence.rb', line 7 def initialize(personal_data, block, range) @block = block @personal_data = personal_data @current_password = '' @range = range || (0..1) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PersonalWordlist::DSL
Instance Method Details
#run! ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/personal_wordlist/dsl/sequence.rb', line 14 def run! passwords = [] @range.to_a.each do |n| # Reset the state of current_password @current_password = '' passwords << instance_exec(n, &@block) end passwords end |