Class: RServiceBus::Globber

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Globber

Returns a new instance of Globber.



11
12
13
# File 'lib/rservicebus/CronManager.rb', line 11

def initialize(str)
    @regex = self.class.parse_to_regex str
end

Class Method Details

.parse_to_regex(str) ⇒ Object



6
7
8
9
# File 'lib/rservicebus/CronManager.rb', line 6

def self.parse_to_regex(str)
    escaped = Regexp.escape(str).gsub('\*','.*?')
    Regexp.new "^#{escaped}$", Regexp::IGNORECASE
end

Instance Method Details

#=~(str) ⇒ Object



15
16
17
# File 'lib/rservicebus/CronManager.rb', line 15

def =~(str)
    !!(str =~ @regex)
end