Class: Nuggets::Array::HistogramMixin::HistogramItem

Inherits:
Struct
  • Object
show all
Defined in:
lib/nuggets/array/histogram_mixin.rb

Overview

Encapsulates a #histogram item and provides the following attributes (see also #annotated_histogram):

item

The original item

freq

The item’s frequency in the collection

percentage

The percentage of the item’s frequency in the collection

max_freq

The maximum frequency in the collection

max_freq_length

The maximum frequency’s “width”

max_item_length

The maximum item length in the collection

Instance Attribute Summary collapse

Instance Attribute Details

#freqObject

Returns the value of attribute freq

Returns:

  • (Object)

    the current value of freq



57
58
59
# File 'lib/nuggets/array/histogram_mixin.rb', line 57

def freq
  @freq
end

#itemObject

Returns the value of attribute item

Returns:

  • (Object)

    the current value of item



57
58
59
# File 'lib/nuggets/array/histogram_mixin.rb', line 57

def item
  @item
end

#max_freqObject

Returns the value of attribute max_freq

Returns:

  • (Object)

    the current value of max_freq



57
58
59
# File 'lib/nuggets/array/histogram_mixin.rb', line 57

def max_freq
  @max_freq
end

#max_freq_lengthObject

Returns the value of attribute max_freq_length

Returns:

  • (Object)

    the current value of max_freq_length



57
58
59
# File 'lib/nuggets/array/histogram_mixin.rb', line 57

def max_freq_length
  @max_freq_length
end

#max_item_lengthObject

Returns the value of attribute max_item_length

Returns:

  • (Object)

    the current value of max_item_length



57
58
59
# File 'lib/nuggets/array/histogram_mixin.rb', line 57

def max_item_length
  @max_item_length
end

#percentageObject

Returns the value of attribute percentage

Returns:

  • (Object)

    the current value of percentage



57
58
59
# File 'lib/nuggets/array/histogram_mixin.rb', line 57

def percentage
  @percentage
end