Sha256: 5c3fac1c4f95fc10ff1eab3fe37ee1e2e41eee406f852d4044266032a02d9d06

Contents?: true

Size: 337 Bytes

Versions: 2

Compression:

Stored size: 337 Bytes

Contents

module ImageMosaic
  module Data
    class Background
      PATTERN = /^#([0-9a-fA-F]{3}){1,2}$/

      def initialize(hex)
        @hex = hex
      end

      def hex
        valid? ? @hex : COLOUR
      end

      private

      def valid?
        !!match
      end

      def match
        @hex =~ PATTERN
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
image_mosaic-0.1.3 lib/image_mosaic/data/background.rb
image_mosaic-0.1.2 lib/image_mosaic/data/background.rb