Class: FileGlob

Inherits:
Object
  • Object
show all
Defined in:
lib/file_glob.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ FileGlob

Returns a new instance of FileGlob.



4
5
6
# File 'lib/file_glob.rb', line 4

def initialize(pattern)
  @pattern = pattern
end

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



2
3
4
# File 'lib/file_glob.rb', line 2

def pattern
  @pattern
end

Instance Method Details

#=~(path) ⇒ Object



8
9
10
# File 'lib/file_glob.rb', line 8

def =~ path
  File.fnmatch?(pattern, path)
end

#inspectObject



16
17
18
# File 'lib/file_glob.rb', line 16

def inspect
  "<#FileGlob #{pattern}>"
end

#to_sObject



12
13
14
# File 'lib/file_glob.rb', line 12

def to_s
  pattern
end