Class: Brute::UsageDetection::Usage

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input: nil, output: nil, total: nil, reasoning: nil, cache_read: nil, cache_write: nil, cost: nil, raw: nil) ⇒ Usage

Returns a new instance of Usage.



23
24
25
26
# File 'lib/brute/usage_detection/usage.rb', line 23

def initialize(input: nil, output: nil, total: nil, reasoning: nil,
               cache_read: nil, cache_write: nil, cost: nil, raw: nil)
  super
end

Instance Attribute Details

#cache_readObject (readonly)

Returns the value of attribute cache_read

Returns:

  • (Object)

    the current value of cache_read



22
23
24
# File 'lib/brute/usage_detection/usage.rb', line 22

def cache_read
  @cache_read
end

#cache_writeObject (readonly)

Returns the value of attribute cache_write

Returns:

  • (Object)

    the current value of cache_write



22
23
24
# File 'lib/brute/usage_detection/usage.rb', line 22

def cache_write
  @cache_write
end

#costObject (readonly)

Returns the value of attribute cost

Returns:

  • (Object)

    the current value of cost



22
23
24
# File 'lib/brute/usage_detection/usage.rb', line 22

def cost
  @cost
end

#inputObject (readonly)

Returns the value of attribute input

Returns:

  • (Object)

    the current value of input



22
23
24
# File 'lib/brute/usage_detection/usage.rb', line 22

def input
  @input
end

#outputObject (readonly)

Returns the value of attribute output

Returns:

  • (Object)

    the current value of output



22
23
24
# File 'lib/brute/usage_detection/usage.rb', line 22

def output
  @output
end

#rawObject (readonly)

Returns the value of attribute raw

Returns:

  • (Object)

    the current value of raw



22
23
24
# File 'lib/brute/usage_detection/usage.rb', line 22

def raw
  @raw
end

#reasoningObject (readonly)

Returns the value of attribute reasoning

Returns:

  • (Object)

    the current value of reasoning



22
23
24
# File 'lib/brute/usage_detection/usage.rb', line 22

def reasoning
  @reasoning
end

#totalObject (readonly)

Returns the value of attribute total

Returns:

  • (Object)

    the current value of total



22
23
24
# File 'lib/brute/usage_detection/usage.rb', line 22

def total
  @total
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


32
# File 'lib/brute/usage_detection/usage.rb', line 32

def empty? = [input, output, total].all?(&:nil?)

#to_hObject

What a provider did not report stays out, so a reader sees the counts that are real rather than a row of nils.



30
# File 'lib/brute/usage_detection/usage.rb', line 30

def to_h = super.compact