Class: Barkdog::DSL::Context::Monitor::Options

Inherits:
Object
  • Object
show all
Includes:
TemplateHelper
Defined in:
lib/barkdog/dsl/context/monitor/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TemplateHelper

#context, #include_template

Constructor Details

#initialize(context, &block) ⇒ Options

Returns a new instance of Options.



4
5
6
7
8
# File 'lib/barkdog/dsl/context/monitor/options.rb', line 4

def initialize(context, &block)
  @context = context.dup
  @result = {}
  instance_eval(&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (private)



14
15
16
17
18
19
20
21
# File 'lib/barkdog/dsl/context/monitor/options.rb', line 14

def method_missing(method_name, *args)
  if args.length == 1
    value = args.first
    @result[method_name.to_s] = value
  else
    super
  end
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



10
11
12
# File 'lib/barkdog/dsl/context/monitor/options.rb', line 10

def result
  @result
end