Class: Arcp::Job::EventBody::Progress

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current

Returns:

  • (Object)

    the current value of current



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

def current
  @current
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



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

def message
  @message
end

#totalObject (readonly)

Returns the value of attribute total

Returns:

  • (Object)

    the current value of total



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

def total
  @total
end

#unitsObject (readonly)

Returns the value of attribute units

Returns:

  • (Object)

    the current value of units



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

def units
  @units
end

Class Method Details

.from_h(h) ⇒ Object



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

def self.from_h(h)
  h = h.transform_keys(&:to_s)
  new(
    current: h.fetch('current'),
    total: h['total'],
    units: h['units'],
    message: h['message']
  )
end

Instance Method Details

#to_hObject



17
18
19
20
21
22
23
# File 'lib/arcp/job/event_body/progress.rb', line 17

def to_h
  out = { 'current' => current }
  out['total']   = total if total
  out['units']   = units if units
  out['message'] = message if message
  out
end