Sha256: c3204a45ea709761e09704226f65ce2639708c26eac3b29b9825197fb5c0aaa2

Contents?: true

Size: 845 Bytes

Versions: 6

Compression:

Stored size: 845 Bytes

Contents

module Zebra
  module Epl
    module BaseMultiplier
      class InvalidMultiplierError < StandardError; end

      VALUE_1 = 1
      VALUE_2 = 2
      VALUE_3 = 3
      VALUE_4 = 4
      VALUE_5 = 5
      VALUE_6 = 6
      VALUE_7 = 7
      VALUE_8 = 8

      def self.included(base_module)
        base_module.instance_eval do
          def validate_multiplier(multiplier)
            raise InvalidMultiplierError unless valid_multiplier?(multiplier)
          end
        end
      end
    end

    module HorizontalMultiplier
      include BaseMultiplier

      def self.valid_multiplier?(multiplier)
        (1..8).include? multiplier
      end
    end

    module VerticalMultiplier
      include BaseMultiplier

      VALUE_9 = 9

      def self.valid_multiplier?(multiplier)
        (1..9).include? multiplier
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zebra-epl-0.0.8 lib/zebra/epl/multipliers.rb
zebra-epl-0.0.7 lib/zebra/epl/multipliers.rb
zebra-epl-0.0.6 lib/zebra/epl/multipliers.rb
zebra-epl-0.0.5 lib/zebra/epl/multipliers.rb
zebra-epl-0.0.2 lib/zebra/epl/multipliers.rb
zebra-epl-0.0.1 lib/zebra/epl/multipliers.rb