Class: Lbrt::Alert::DSL::Context

Inherits:
Object
  • Object
show all
Includes:
Utils::ContextHelper, Utils::TemplateHelper
Defined in:
lib/lbrt/alert/dsl/context.rb

Defined Under Namespace

Classes: Alert

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::TemplateHelper

#include_template

Methods included from Utils::ContextHelper

#require, #template

Constructor Details

#initialize(client, path, options = {}, &block) ⇒ Context



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lbrt/alert/dsl/context.rb', line 14

def initialize(client, path, options = {}, &block)
  @path = path
  @options = options
  @result = {}
  @services = Lbrt::Service::Exporter.export(client, options)

  @context = Hashie::Mash.new(
    :path => path,
    :options => options,
    :templates => {}
  )

  instance_eval(&block)
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



12
13
14
# File 'lib/lbrt/alert/dsl/context.rb', line 12

def context
  @context
end

#resultObject (readonly)

Returns the value of attribute result.



11
12
13
# File 'lib/lbrt/alert/dsl/context.rb', line 11

def result
  @result
end

Class Method Details

.eval(client, dsl, path, options = {}) ⇒ Object



5
6
7
8
9
# File 'lib/lbrt/alert/dsl/context.rb', line 5

def self.eval(client, dsl, path, options = {})
  self.new(client, path, options) {
    eval(dsl, binding, path)
  }
end