Class: LCBO::CrawlKit::VolumeHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/lcbo/crawlkit/volume_helper.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ VolumeHelper

Returns a new instance of VolumeHelper.


7
8
9
10
11
12
13
14
# File 'lib/lcbo/crawlkit/volume_helper.rb', line 7

def initialize(input)
  @input = input
  @package_volume = 0
  @unit_volume = 0
  @total_units = 0
  calculate
  self
end

Instance Attribute Details

#package_volumeObject (readonly)

Returns the value of attribute package_volume


5
6
7
# File 'lib/lcbo/crawlkit/volume_helper.rb', line 5

def package_volume
  @package_volume
end

#total_unitsObject (readonly)

Returns the value of attribute total_units


5
6
7
# File 'lib/lcbo/crawlkit/volume_helper.rb', line 5

def total_units
  @total_units
end

#unit_typeObject (readonly)

Returns the value of attribute unit_type


5
6
7
# File 'lib/lcbo/crawlkit/volume_helper.rb', line 5

def unit_type
  @unit_type
end

#unit_volumeObject (readonly)

Returns the value of attribute unit_volume


5
6
7
# File 'lib/lcbo/crawlkit/volume_helper.rb', line 5

def unit_volume
  @unit_volume
end

Class Method Details

.[](input_string) ⇒ Object


16
17
18
# File 'lib/lcbo/crawlkit/volume_helper.rb', line 16

def self.[](input_string)
  new(input_string).as_milliliters
end

Instance Method Details

#as_millilitersObject


20
21
22
# File 'lib/lcbo/crawlkit/volume_helper.rb', line 20

def as_milliliters
  @package_volume
end