Class: Meteor::Core::Util::PatternCache
- Inherits:
-
Object
- Object
- Meteor::Core::Util::PatternCache
- Defined in:
- lib/meteor.rb
Overview
パターンキャッシュクラス
Constant Summary collapse
- @@regex_cache =
Hash.new
Class Method Summary collapse
-
.get(*args) ⇒ Object
パターンを取得する.
Instance Method Summary collapse
-
#initialize ⇒ PatternCache
constructor
イニシャライザ.
Constructor Details
Class Method Details
.get(regex) ⇒ Regexp .get(regex, option) ⇒ Regexp
パターンを取得する
2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 |
# File 'lib/meteor.rb', line 2893 def self.get(*args) case args.length when ONE #get_1(args[0]) if !@@regex_cache[args[0].to_sym] then #if RUBY_VERSION >= RUBY_VERSION_1_9_0 then @@regex_cache[args[0].to_sym] = Regexp.new(args[0], Regexp::MULTILINE) #else # @@regex_cache[args[0].to_sym] = Regexp.new(args[0], Regexp::MULTILINE,E_UTF8) #end end @@regex_cache[args[0].to_sym] when TWO #get_2(args[0], args[1]) if !@@regex_cache[args[0].to_sym] then #if RUBY_VERSION >= RUBY_VERSION_1_9_0 then @@regex_cache[args[0].to_sym] = Regexp.new(args[0], args[1]) #else # @@regex_cache[args[0].to_sym] = Regexp.new(args[0], args[1],E_UTF8) #end end @@regex_cache[args[0].to_sym] else raise ArgumentError end end |