Module: Regex

Includes:
Templates
Defined in:
lib/regex.rb,
lib/regex/string.rb,
lib/regex/command.rb,
lib/regex/replacer.rb,
lib/regex/extractor.rb,
lib/regex/templates.rb

Defined Under Namespace

Modules: String, Templates Classes: Extractor, Replacer

Constant Summary collapse

VERSION =

TODO: This is only here to support broken Ruby 1.8.x.

['version']

Constants included from Templates

Templates::BIC, Templates::BLANK, Templates::CREDITCARD, Templates::DELICIOUS_USERNMAME, Templates::DNI, Templates::DOLLARS, Templates::EMAIL, Templates::EMPTY, Templates::GITHUB_USERNAME, Templates::HEX, Templates::HTTP, Templates::IBAN, Templates::IPV4, Templates::MASTERCARD, Templates::MLTAG, Templates::NUMBER, Templates::PRIMEONES, Templates::RUBYBLOCK, Templates::RUBYMETHOD, Templates::RUBYMETHOD_WITH_COMMENT, Templates::SLIDESHARE_USERNAME, Templates::SSN, Templates::TWITTER_USERNMAE, Templates::UNIXWORD, Templates::USERNAME, Templates::USPHONE, Templates::USZIP, Templates::VISA

Class Method Summary collapse

Methods included from Templates

[], list

Class Method Details

.cli(*argv) ⇒ Object

Commandline interface.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/regex/command.rb', line 7

def self.cli(*argv)
  if argv.include?('-r') or argv.include?('--replace')
    controller = Replacer
  else
    controller = Extractor
  end

  begin
    controller.cli(argv)
  rescue => error
    if $DEBUG
      raise error
      #puts error.backtrace.join("\n   ")
    else
      abort error.to_s
    end
  end
end

.const_missing(name) ⇒ Object

Need VRESION? You got it.



11
12
13
# File 'lib/regex.rb', line 11

def self.const_missing(name)
  [name.to_s.downcase] || super(name)
end

.metadataObject

Access to PACAKGE metadata.



3
4
5
6
7
8
# File 'lib/regex.rb', line 3

def self.
  @metadata ||= (
    require 'yaml'
    YAML.load(File.new(File.dirname(__FILE__) + '/regex.yml'))
  )
end

.new(*io) ⇒ Object

Shortcut to create a new Regex::Extractor instance.



19
20
21
# File 'lib/regex.rb', line 19

def self.new(*io)
  Extractor.new(*io)
end