Sha256: 2268df831106e613435402ccbd4571c92ab9c99f704c8c9fa085a5d173ea2a92

Contents?: true

Size: 606 Bytes

Versions: 8

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

class BCDD::Result
  class Data
    attr_reader :kind, :type, :value

    def initialize(kind, type, value)
      @kind = kind
      @type = type.to_sym
      @value = value
    end

    def to_h
      { kind: kind, type: type, value: value }
    end

    def to_a
      [kind, type, value]
    end

    def inspect
      format(
        '#<%<class_name>s kind=%<kind>p type=%<type>p value=%<value>p>',
        class_name: self.class.name, kind: kind, type: type, value: value
      )
    end

    alias to_ary to_a
    alias to_hash to_h
  end

  private_constant :Data
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bcdd-result-1.1.0 lib/bcdd/result/data.rb
bcdd-result-1.0.0 lib/bcdd/result/data.rb
bcdd-result-0.13.0 lib/bcdd/result/data.rb
bcdd-result-0.12.0 lib/bcdd/result/data.rb
bcdd-result-0.11.0 lib/bcdd/result/data.rb
bcdd-result-0.10.0 lib/bcdd/result/data.rb
bcdd-result-0.9.1 lib/bcdd/result/data.rb
bcdd-result-0.9.0 lib/bcdd/result/data.rb