Class: Chirp::Named

Inherits:
FSExpression show all
Defined in:
lib/chirp/fs_expression.rb

Instance Method Summary collapse

Methods inherited from FSExpression

#&, #|, #~

Constructor Details

#initialize(name) ⇒ Named

Returns a new instance of Named.



19
20
21
# File 'lib/chirp/fs_expression.rb', line 19

def initialize(name)
  @name = name
end

Instance Method Details

#evaluate(path) ⇒ Object



23
24
25
26
27
# File 'lib/chirp/fs_expression.rb', line 23

def evaluate(path)
  return true if @name.kind_of?(Regexp) and (@name =~ path)
  return true if @name.kind_of?(String) and (File.fnmatch(@name, path))
  false
end