Class: Meteor::Core::Util::PatternCache
- Inherits:
-
Object
- Object
- Meteor::Core::Util::PatternCache
- Defined in:
- lib/meteor.rb
Overview
Pattern Cache Class (パターンキャッシュクラス)
Constant Summary collapse
- @@regex_cache =
Hash.new
Class Method Summary collapse
-
.get(*args) ⇒ Object
get pattern (パターンを取得する).
Class Method Details
.get(regex) ⇒ Regexp .get(regex, option) ⇒ Regexp
get pattern (パターンを取得する)
3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 |
# File 'lib/meteor.rb', line 3873 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 |