Class: Regex2String::Unmatched
- Inherits:
-
Object
- Object
- Regex2String::Unmatched
- Defined in:
- lib/regex2string/unmatched.rb
Instance Attribute Summary collapse
-
#char_count ⇒ Object
Returns the value of attribute char_count.
-
#regex ⇒ Object
Returns the value of attribute regex.
Instance Method Summary collapse
- #generate_unmatched ⇒ Object
-
#initialize(regex, char_count) ⇒ Unmatched
constructor
A new instance of Unmatched.
Constructor Details
#initialize(regex, char_count) ⇒ Unmatched
Returns a new instance of Unmatched.
6 7 8 9 |
# File 'lib/regex2string/unmatched.rb', line 6 def initialize(regex, char_count) @regex = regex @char_count = char_count end |
Instance Attribute Details
#char_count ⇒ Object
Returns the value of attribute char_count.
4 5 6 |
# File 'lib/regex2string/unmatched.rb', line 4 def char_count @char_count end |
#regex ⇒ Object
Returns the value of attribute regex.
3 4 5 |
# File 'lib/regex2string/unmatched.rb', line 3 def regex @regex end |
Instance Method Details
#generate_unmatched ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/regex2string/unmatched.rb', line 11 def generate_unmatched rand_string = Faker::Lorem.characters(@char_count) while (true) break unless @regex.match rand_string rand_string = Faker::Lorem.characters(@char_count) end rand_string end |