Class: Statlysis::CronSet

Inherits:
Set
  • Object
show all
Defined in:
lib/statlysis/cron_set.rb

Instance Method Summary collapse

Instance Method Details

#[](pattern = nil) ⇒ Object

filter cron_sets by pattern



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/statlysis/cron_set.rb', line 8

def [] pattern = nil
  case pattern
  when Fixnum, Integer # support array idx access
    self.to_a[pattern]
  else
    CronSet.new(self.select do |cron|
      reg = Regexp.new(pattern.to_s)
      cron.stat_table_name.match(reg) || cron.multiple_dataset.name.to_s.match(reg)
    end)
  end
end

#lastObject



20
# File 'lib/statlysis/cron_set.rb', line 20

def last; self[-1]; end

#runObject



22
23
24
# File 'lib/statlysis/cron_set.rb', line 22

def run
  map(&:run)
end