Class: PuppetX::Relay::Agent::Model::Run
- Inherits:
-
Object
- Object
- PuppetX::Relay::Agent::Model::Run
show all
- Includes:
- Stateful
- Defined in:
- lib/puppet_x/relay/agent/model/run.rb
Defined Under Namespace
Classes: MissingScopeError
Instance Attribute Summary collapse
Attributes included from Stateful
#id, #state
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Stateful
#with_state
Constructor Details
#initialize(opts) ⇒ Run
Returns a new instance of Run.
36
37
38
39
40
41
42
|
# File 'lib/puppet_x/relay/agent/model/run.rb', line 36
def initialize(opts)
opts = defaults.merge(opts)
raise MissingScopeError unless opts.key? 'scope'
opts.each { |key, value| instance_variable_set("@#{key}", value) }
end
|
Instance Attribute Details
#debug ⇒ Boolean
33
34
35
|
# File 'lib/puppet_x/relay/agent/model/run.rb', line 33
def debug
@debug
end
|
#environment ⇒ String
27
28
29
|
# File 'lib/puppet_x/relay/agent/model/run.rb', line 27
def environment
@environment
end
|
#evaltrace ⇒ Boolean
33
34
35
|
# File 'lib/puppet_x/relay/agent/model/run.rb', line 33
def evaltrace
@evaltrace
end
|
#noop ⇒ Boolean
33
34
35
|
# File 'lib/puppet_x/relay/agent/model/run.rb', line 33
def noop
@noop
end
|
30
31
32
|
# File 'lib/puppet_x/relay/agent/model/run.rb', line 30
def scope
@scope
end
|
#trace ⇒ Boolean
33
34
35
|
# File 'lib/puppet_x/relay/agent/model/run.rb', line 33
def trace
@trace
end
|
Class Method Details
.from_h(hsh) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/puppet_x/relay/agent/model/run.rb', line 18
def from_h(hsh)
hsh = hsh.dup
hsh['scope'] = Scope.from_h(hsh['scope']) if hsh.key? 'scope'
hsh['state'] = State.from_h(hsh['state']) if hsh.key? 'state'
new(hsh)
end
|
Instance Method Details
#to_json(*args) ⇒ String
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/puppet_x/relay/agent/model/run.rb', line 45
def to_json(*args)
{
id: id,
environment: environment,
scope: scope,
noop: noop,
debug: debug,
trace: trace,
evaltrace: evaltrace,
state: state,
}.to_json(*args)
end
|