Class: Toro::Monitor::CustomViews

Inherits:
Object
  • Object
show all
Defined in:
lib/toro/monitor/custom_views.rb

Class Method Summary collapse

Class Method Details

.add(name, path, &block) ⇒ Object


7
8
9
10
11
12
13
# File 'lib/toro/monitor/custom_views.rb', line 7

def add(name, path, &block)
  @views << {
    name: name,
    path: path,
    filter: block
  }
end

.for_job(job) ⇒ Object


15
16
17
18
19
20
21
22
# File 'lib/toro/monitor/custom_views.rb', line 15

def for_job(job)
  views = []
  @views.each do |view|
    is_valid = view[:filter].call(job)
    views << view.dup if is_valid
  end
  views
end