Sha256: c280966aa9678976f344b7163ab34fa43d5368a649b32ae8b861b448e4f7a41a
Contents?: true
Size: 444 Bytes
Versions: 3
Compression:
Stored size: 444 Bytes
Contents
# frozen_string_literal: true module RGB Number = Micro::Struct.with(:readonly).new(:value, :label) do Input = Kind.object(name: 'Integer(>= 0 and <= 255)') do |value| value.is_a?(::Integer) && value >= 0 && value <= 255 end def initialize(value, label) super(Input[value, label: label]) end def to_s @to_s ||= '%02x' % value end def inspect "#<RGB::Number #{value}>" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
u-struct-1.0.0 | examples/rgb/number.rb |
u-struct-0.12.0 | examples/rgb/number.rb |
u-struct-0.11.0 | examples/rgb/number.rb |