Class: LOCat::Matcher

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/locat/matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#rulesObject (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

#sizeObject



34
35
36
# File 'lib/locat/matcher.rb', line 34

def size
  @rules.size
end