Class: Arcp::Job::EventBody::Delegate

Inherits:
Data
  • Object
show all
Defined in:
lib/arcp/job/event_body/delegate.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent

Returns:

  • (Object)

    the current value of agent



6
7
8
# File 'lib/arcp/job/event_body/delegate.rb', line 6

def agent
  @agent
end

#child_job_idObject (readonly)

Returns the value of attribute child_job_id

Returns:

  • (Object)

    the current value of child_job_id



6
7
8
# File 'lib/arcp/job/event_body/delegate.rb', line 6

def child_job_id
  @child_job_id
end

#leaseObject (readonly)

Returns the value of attribute lease

Returns:

  • (Object)

    the current value of lease



6
7
8
# File 'lib/arcp/job/event_body/delegate.rb', line 6

def lease
  @lease
end

Class Method Details

.from_h(h) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/arcp/job/event_body/delegate.rb', line 7

def self.from_h(h)
  h = h.transform_keys(&:to_s)
  new(
    child_job_id: h.fetch('child_job_id'),
    agent: h.fetch('agent'),
    lease: h['lease'] ? Arcp::Lease::Lease.from_h(h['lease']) : nil
  )
end

Instance Method Details

#to_hObject



16
17
18
19
20
# File 'lib/arcp/job/event_body/delegate.rb', line 16

def to_h
  out = { 'child_job_id' => child_job_id, 'agent' => agent }
  out['lease'] = lease.to_h if lease
  out
end