Class: Mistri::Usage::Cost

Inherits:
Data
  • Object
show all
Defined in:
lib/mistri/usage.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cache_readObject (readonly)

Returns the value of attribute cache_read

Returns:

  • (Object)

    the current value of cache_read



12
13
14
# File 'lib/mistri/usage.rb', line 12

def cache_read
  @cache_read
end

#cache_writeObject (readonly)

Returns the value of attribute cache_write

Returns:

  • (Object)

    the current value of cache_write



12
13
14
# File 'lib/mistri/usage.rb', line 12

def cache_write
  @cache_write
end

#inputObject (readonly)

Returns the value of attribute input

Returns:

  • (Object)

    the current value of input



12
13
14
# File 'lib/mistri/usage.rb', line 12

def input
  @input
end

#outputObject (readonly)

Returns the value of attribute output

Returns:

  • (Object)

    the current value of output



12
13
14
# File 'lib/mistri/usage.rb', line 12

def output
  @output
end

#totalObject (readonly)

Returns the value of attribute total

Returns:

  • (Object)

    the current value of total



12
13
14
# File 'lib/mistri/usage.rb', line 12

def total
  @total
end

Class Method Details

.zeroObject



13
# File 'lib/mistri/usage.rb', line 13

def self.zero = new(input: 0.0, output: 0.0, cache_read: 0.0, cache_write: 0.0, total: 0.0)

Instance Method Details

#+(other) ⇒ Object



15
16
17
18
19
20
# File 'lib/mistri/usage.rb', line 15

def +(other)
  self.class.new(input: input + other.input, output: output + other.output,
                 cache_read: cache_read + other.cache_read,
                 cache_write: cache_write + other.cache_write,
                 total: total + other.total)
end