Sha256: 43c2ebb5656677335a87f813e9d6ea921ba10125830c081436ce6bddbc9e34dd

Contents?: true

Size: 399 Bytes

Versions: 1

Compression:

Stored size: 399 Bytes

Contents

# frozen_string_literal: true

module RGB
  Number = Micro::Struct.with(:readonly).new(:value) do
    def to_s
      value.to_s(16)
    end
  end

  module Number
    Input = Kind.object(name: 'Integer(>= 0 and <= 255)') do |value|
      value.is_a?(::Integer) && value >= 0 && value <= 255
    end

    def self.new(value, label:)
      __new__(value: Input[value, label: label])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
u-struct-0.9.0 examples/rgb/number.rb