Class: Fynd::Sieve

Inherits:
Object
  • Object
show all
Includes:
Actions, Helpers, Operators, Tests
Defined in:
lib/fynd/sieve.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Tests

#amin, #anewer, #atime, #cmin, #cnewer, #ctime, #empty, #false, #gid, #group, #ilname, #iname, #inum, #iregex, #iwholename, #links, #lname, #mmin, #mtime, #name, #newer, #nogroup, #nouser, #path, #perm, #regex, #samefile, #size, #true, #type, #uid, #used, #user, #wholename, #xtype

Methods included from Operators

#and, #not, #or

Methods included from Actions

#delete, #exec, #execdir, #fls, #fprint, #fprint0, #fprintf, #ok, #okdir, #print, #print0, #printf

Constructor Details

#initializeSieve

Returns a new instance of Sieve.



17
18
19
20
21
# File 'lib/fynd/sieve.rb', line 17

def initialize
  @collection = []
  @conditions = {}
  @files = nil
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



15
16
17
# File 'lib/fynd/sieve.rb', line 15

def collection
  @collection
end

#conditionsObject

Returns the value of attribute conditions.



15
16
17
# File 'lib/fynd/sieve.rb', line 15

def conditions
  @conditions
end

#filesObject

Returns the value of attribute files.



15
16
17
# File 'lib/fynd/sieve.rb', line 15

def files
  @files
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
# File 'lib/fynd/sieve.rb', line 23

def run
  @files = collection.dup
  # first we match files with our tests 
  conditions['tests'].each do |symbol, value|
    value.nil? ? self.__send__(symbol) : self.__send__(symbol, value)
  end
  
  @files
end