Sha256: 0879aca7a3e4ac4959b7570acc71e9bdcdb752c4b5e852f61739857dee76b2e5

Contents?: true

Size: 377 Bytes

Versions: 1

Compression:

Stored size: 377 Bytes

Contents

# frozen_string_literal: true

module RGB
  Number = Micro::Struct.with(:readonly).new(:value) do
    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

    def to_s
      value.to_s(16)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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