Sha256: 4189e8d916060bcba488340f99f984bca4f48598973be9124fc8478acd14eac8

Contents?: true

Size: 396 Bytes

Versions: 4

Compression:

Stored size: 396 Bytes

Contents

# frozen_string_literal: true

module Grumlin
  # TODO: find a better name
  class TypedValue
    def initialize(type, value)
      @type = type
      @value = value
    end

    def to_bytecode
      @to_bytecode ||= { "@type": "g:#{@type}", "@value": @value }
    end

    def inspect
      "<#{@type}.#{@value}>"
    end
    alias to_s inspect
    alias to_readable_bytecode inspect
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
grumlin-0.10.1 lib/grumlin/typed_value.rb
grumlin-0.10.0 lib/grumlin/typed_value.rb
grumlin-0.9.0 lib/grumlin/typed_value.rb
grumlin-0.8.0 lib/grumlin/typed_value.rb