Method: Fynd::Tests#iname

Defined in:
lib/fynd/tests.rb

#iname(pattern) ⇒ Object

Like -name, but the match is case insensitive. For example, the patterns ‘fo*’ and ‘F??’ match the file names ‘Foo’, ‘FOO’, ‘foo’, ‘fOo’, etc. In these patterns, unlike filename expan- sion by the shell, an initial ‘.’ can be matched by ‘*’. That is, find -name *bar will match the file ‘.foobar’. Please note that you should quote patterns as a matter of course, otherwise the shell will expand any wildcard characters in them.



117
118
119
120
121
# File 'lib/fynd/tests.rb', line 117

def iname(pattern)
  files.select! do |file|
    file =~ /#{pattern}/i
  end
end