class Meteor::Core::Util::PatternCache

Pattern Cache Class (パターンキャッシュクラス)

Public Class Methods

get(*args) click to toggle source

get pattern (パターンを取得する) @overload get(regex)

@param [String] regex regular expression (正規表現)
@return [Regexp] pattern (パターン)

@overload get(regex,option)

@param [String] regex regular expression (正規表現)
@param [Fixnum] option option of Regex (オプション)
@return [Regexp] pattern (パターン)
# File lib/meteor.rb, line 3941
def self.get(*args)
  case args.length
    when ONE
      #get_1(args[0])
      if @@regex_cache[args[0].to_sym]
        @@regex_cache[args[0].to_sym]
      else
        @@regex_cache[args[0].to_sym] = Regexp.new(args[0], Regexp::MULTILINE)
      end
    when TWO
      #get_2(args[0], args[1])
      if @@regex_cache[args[0].to_sym]
        @@regex_cache[args[0].to_sym]
      else
        @@regex_cache[args[0].to_sym] = Regexp.new(args[0], args[1])
      end
    else
      raise ArgumentError
  end
end