Class: Vishnu::StandardTime::Duration

Inherits:
Struct
  • Object
show all
Defined in:
lib/vishnu/standard_time.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#flowsObject

Returns the value of attribute flows

Returns:

  • (Object)

    the current value of flows



40
41
42
# File 'lib/vishnu/standard_time.rb', line 40

def flows
  @flows
end

#millisecondsObject

Returns the value of attribute milliseconds

Returns:

  • (Object)

    the current value of milliseconds



40
41
42
# File 'lib/vishnu/standard_time.rb', line 40

def milliseconds
  @milliseconds
end

#secondsObject

Returns the value of attribute seconds

Returns:

  • (Object)

    the current value of seconds



40
41
42
# File 'lib/vishnu/standard_time.rb', line 40

def seconds
  @seconds
end

#targetObject

Returns the value of attribute target

Returns:

  • (Object)

    the current value of target



40
41
42
# File 'lib/vishnu/standard_time.rb', line 40

def target
  @target
end

Instance Method Details

#hoursObject



51
52
53
# File 'lib/vishnu/standard_time.rb', line 51

def hours
  seconds / 3600.0
end

#minutesObject



47
48
49
# File 'lib/vishnu/standard_time.rb', line 47

def minutes
  seconds / 60.0
end

#to_hObject



55
56
57
58
59
60
61
62
63
64
# File 'lib/vishnu/standard_time.rb', line 55

def to_h
  {
    flows: flows,
    milliseconds: milliseconds,
    seconds: seconds,
    minutes: minutes,
    hours: hours,
    target: target && Vishnu::StandardTime.to_h(target)
  }
end