Sha256: 4f284ae916a86a73fca129c0714ea200999a032295880bbbe7d74010d87bd0b8

Contents?: true

Size: 845 Bytes

Versions: 9

Compression:

Stored size: 845 Bytes

Contents

module Zebra
  module Zpl
    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

9 entries across 9 versions & 1 rubygems

Version Path
zebra-zpl-1.1.4 lib/zebra/zpl/multipliers.rb
zebra-zpl-1.1.3 lib/zebra/zpl/multipliers.rb
zebra-zpl-1.1.2 lib/zebra/zpl/multipliers.rb
zebra-zpl-1.1.1 lib/zebra/zpl/multipliers.rb
zebra-zpl-1.1.0 lib/zebra/zpl/multipliers.rb
zebra-zpl-1.0.5 lib/zebra/zpl/multipliers.rb
zebra-zpl-1.0.2 lib/zebra/zpl/multipliers.rb
zebra-zpl-1.0.1 lib/zebra/zpl/multipliers.rb
zebra-zpl-1.0.0 lib/zebra/zpl/multipliers.rb