class BarcodeValidation::DigitSequence

Constants

ArgumentError

Public Class Methods

cast(input) click to toggle source
# File lib/barcodevalidation/digit_sequence.rb, line 14
def self.cast(input)
  input = input.to_s if input.is_a? Integer
  input = input.chars if input.is_a? String
  input
end
new(values) click to toggle source
Calls superclass method
# File lib/barcodevalidation/digit_sequence.rb, line 20
def initialize(values)
  values = cast(values)
  raise ArgumentError, values unless values.respond_to? :map

  super(values.map { |value| BarcodeValidation::Digit.new(value) })
end

Public Instance Methods

*(other) click to toggle source
Calls superclass method
# File lib/barcodevalidation/digit_sequence.rb, line 34
def *(other)
  self.class.new(super)
end
==(other) click to toggle source
Calls superclass method
# File lib/barcodevalidation/digit_sequence.rb, line 27
def ==(other)
  case other
  when String, Numeric then super(self.class.new(other))
  else super
  end
end