Class: Jerakia::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/jerakia/scope/server.rb,
lib/jerakia/scope.rb,
lib/jerakia/scope/yaml.rb,
lib/jerakia/scope/metadata.rb,
lib/jerakia/scope/puppetdb.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, Puppetdb, Server, Yaml

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(req) ⇒ Scope

Returns a new instance of Scope.



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

def initialize(req)
  @value = {}
  @handler ||= req.scope || :metadata
  @request = req
  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.



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

def handler
  @handler
end

#requestObject (readonly)

Returns the value of attribute request.



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

def request
  @request
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end