Class: Jerakia::Scope

Inherits:
Policy show all
Defined in:
lib/jerakia/scope/metadata.rb,
lib/jerakia/scope.rb,
lib/jerakia/scope/yaml.rb

Overview

Default scope handler, this handler creates the scope using the key value pairs from the metadata of the request object

This is by far the simplest scope handler, others can be more complex and build the scope.value hash from MCollective, PuppetDB or other data sources

Defined Under Namespace

Modules: Metadata, Yaml

Instance Attribute Summary collapse

Attributes inherited from Policy

#answer, #lookup_proceed, #lookups, #routes, #scope

Attributes inherited from Launcher

#answer, #request

Instance Method Summary collapse

Methods inherited from Policy

#clone_request, #fire!, #lookup

Methods inherited from Launcher

#invoke, #policy

Constructor Details

#initialize(handler = nil) ⇒ Scope

Returns a new instance of Scope.



6
7
8
9
10
11
12
# File 'lib/jerakia/scope.rb', line 6

def initialize(handler=nil)
  @value = {}
  @handler ||= request.scope || :metadata
  Jerakia::Util.autoload('scope', @handler)
  instance_eval "extend Jerakia::Scope::#{@handler.to_s.capitalize}"
  create
end

Instance Attribute Details

#handlerObject (readonly)

Returns the value of attribute handler.



4
5
6
# File 'lib/jerakia/scope.rb', line 4

def handler
  @handler
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/jerakia/scope.rb', line 3

def value
  @value
end