Class: Chirp::Contains
- Inherits:
-
FSExpression
- Object
- FSExpression
- Chirp::Contains
- Defined in:
- lib/chirp/fs_expression.rb
Instance Method Summary collapse
- #evaluate(path) ⇒ Object
-
#initialize(re) ⇒ Contains
constructor
A new instance of Contains.
Methods inherited from FSExpression
Constructor Details
#initialize(re) ⇒ Contains
Returns a new instance of Contains.
43 44 45 |
# File 'lib/chirp/fs_expression.rb', line 43 def initialize(re) @re = re end |
Instance Method Details
#evaluate(path) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/chirp/fs_expression.rb', line 47 def evaluate(path) return false unless File.file?(path) File.open(path) do |f| until f.eof? return true if @re =~ f.readline end end false end |