Class: StringPattern

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

Overview

SP_ADD_TO_RUBY: (TrueFalse, default: true) You need to add this constant value before requiring the library if you want to modify the default. If true it will add 'generate' and 'validate' methods to the classes: Array, String and Symbol. Also it will add 'generate' method to Kernel aliases: 'gen' for 'generate' and 'val' for 'validate' Examples of use: "(,3:N,) ,3:N,-,2:N,-,2:N".split(",").generate #>(937) 980-65-05 %w3:N ) 1:_ 3:N - 2:N - 2:N.gen #>(045) 448-63-09 ["1:L", "5-10:LN", "-", "3:N"].gen #>zqWihV-746 gen("10:N") #>3433409877 "20-30:@".gen #>[email protected] "10:L/N/[/-./%d%]".validate("12ds6f--.s") #>[:value, :string_set_not_allowed] "20-40:@".validate(my_email) national_chars: (Array, default: english alphabet) Set of characters that will be used when using T pattern optimistic: (TrueFalse, default: true) If true it will check on the strings of the array positions if they have the pattern format and assume in that case that is a pattern. dont_repeat: (TrueFalse, default: false) If you want to generate for example 1000 strings and be sure all those strings are different you can set it to true default_infinite: (Integer, default: 10) In case using regular expressions the maximum when using * or + for repetitions word_separator: (String, default: '_') When generating words using symbol types 'w' or 'p' the character to separate the english or spanish words.

Defined Under Namespace

Classes: Pattern

Constant Summary collapse

NUMBER_SET =
("0".."9").to_a
SPECIAL_SET =
[" ", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "=", "{", "}", "[", "]", "'", ";", ":", "?", ">", "<", "`", "|", "/", '"']
ALPHA_SET_LOWER =
("a".."z").to_a
ALPHA_SET_CAPITAL =
("A".."Z").to_a

Class Attribute Summary collapse

Class Attribute Details

.cacheObject

Returns the value of attribute cache.



30
31
32
# File 'lib/string_pattern.rb', line 30

def cache
  @cache
end

.cache_valuesObject

Returns the value of attribute cache_values.



30
31
32
# File 'lib/string_pattern.rb', line 30

def cache_values
  @cache_values
end

.default_infiniteObject

Returns the value of attribute default_infinite.



30
31
32
# File 'lib/string_pattern.rb', line 30

def default_infinite
  @default_infinite
end

.dont_repeatObject

Returns the value of attribute dont_repeat.



30
31
32
# File 'lib/string_pattern.rb', line 30

def dont_repeat
  @dont_repeat
end

.national_charsObject

Returns the value of attribute national_chars.



30
31
32
# File 'lib/string_pattern.rb', line 30

def national_chars
  @national_chars
end

.optimisticObject

Returns the value of attribute optimistic.



30
31
32
# File 'lib/string_pattern.rb', line 30

def optimistic
  @optimistic
end

.word_separatorObject

Returns the value of attribute word_separator.



30
31
32
# File 'lib/string_pattern.rb', line 30

def word_separator
  @word_separator
end