Sha256: ff3f77f5c5518e5430a96de1a6a72fa6d118cafd2b4b14c48d64f0042ea6493f

Contents?: true

Size: 305 Bytes

Versions: 1

Compression:

Stored size: 305 Bytes

Contents

module Iz
  class Hexadecimal
    REGEX = /^[0-9a-f]+$/i

    attr_accessor :value

    def initialize(hexadecimal)
      self.value = hexadecimal
    end

    def valid?
      Iz::Hexadecimal.is_hexadecimal?(value)
    end

    def self.is_hexadecimal?(value)
      value.to_s =~ REGEX
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iz-0.0.1 lib/iz/hexadecimal.rb