Class: SolidusVolumePricing::RangeFromString

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_volume_pricing/range_from_string.rb

Constant Summary collapse

RANGE_FORMAT =
/\A\(?(\d+)(\.{2,3})(\d+)\)?\z/.freeze
OPEN_ENDED =
/\(?[0-9]+\+\)?/.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(range_string) ⇒ RangeFromString

Returns a new instance of RangeFromString.



10
11
12
# File 'lib/solidus_volume_pricing/range_from_string.rb', line 10

def initialize(range_string)
  @range_string = range_string
end

Instance Attribute Details

#range_stringObject (readonly)

Returns the value of attribute range_string.



5
6
7
# File 'lib/solidus_volume_pricing/range_from_string.rb', line 5

def range_string
  @range_string
end

Instance Method Details

#to_rangeObject



14
15
16
# File 'lib/solidus_volume_pricing/range_from_string.rb', line 14

def to_range
  ::Range.new(*options_from_string)
end