Class: HaveAPI::Client::ActionState::Progress

Inherits:
Struct
  • Object
show all
Defined in:
lib/haveapi/client/action_state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#currentObject

Returns the value of attribute current

Returns:

  • (Object)

    the current value of current



4
5
6
# File 'lib/haveapi/client/action_state.rb', line 4

def current
  @current
end

#totalObject

Returns the value of attribute total

Returns:

  • (Object)

    the current value of total



4
5
6
# File 'lib/haveapi/client/action_state.rb', line 4

def total
  @total
end

#unitObject

Returns the value of attribute unit

Returns:

  • (Object)

    the current value of unit



4
5
6
# File 'lib/haveapi/client/action_state.rb', line 4

def unit
  @unit
end

Instance Method Details

#percentObject



5
6
7
# File 'lib/haveapi/client/action_state.rb', line 5

def percent
  100.0 / total * current
end

#to_sObject



9
10
11
# File 'lib/haveapi/client/action_state.rb', line 9

def to_s
  "#{current}/#{total} #{unit}"
end