Sha256: 566c5fab981d75aef88c1e01dd5d0593c7455ea3489cfbeb9a47282acd936160

Contents?: true

Size: 484 Bytes

Versions: 7

Compression:

Stored size: 484 Bytes

Contents

module Toro
  module Monitor
    class CustomViews
      @views = []

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
toro-0.2.2 lib/toro/monitor/custom_views.rb
toro-0.2.1 lib/toro/monitor/custom_views.rb
toro-0.2.0 lib/toro/monitor/custom_views.rb
toro-0.1.1 lib/toro/monitor/custom_views.rb
toro-0.1.0 lib/toro/monitor/custom_views.rb
toro-0.0.3 lib/toro/monitor/custom_views.rb
toro-0.0.2 lib/toro/monitor/custom_views.rb