Class: LOCat::Matcher
- Inherits:
-
Object
- Object
- LOCat::Matcher
- Includes:
- Enumerable
- Defined in:
- lib/locat/matcher.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(*config_files) ⇒ Matcher
constructor
A new instance of Matcher.
- #match(files, &block) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(*config_files) ⇒ Matcher
Returns a new instance of Matcher.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/locat/matcher.rb', line 8 def initialize(*config_files) @rules = [] if config_files.empty? default end config_files.each do |f| instance_eval(File.read(f)) end end |
Instance Attribute Details
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
21 22 23 |
# File 'lib/locat/matcher.rb', line 21 def rules @rules end |
Instance Method Details
#each(&block) ⇒ Object
29 30 31 |
# File 'lib/locat/matcher.rb', line 29 def each(&block) @rules.each(&block) end |
#match(files, &block) ⇒ Object
24 25 26 |
# File 'lib/locat/matcher.rb', line 24 def match(files, &block) @rules << [files, block] end |
#size ⇒ Object
34 35 36 |
# File 'lib/locat/matcher.rb', line 34 def size @rules.size end |