Sha256: a2f6d707e730841aff1eac2babc63aa97cff22dbb4442a2cb46e48a7e220b5f0

Contents?: true

Size: 606 Bytes

Versions: 4

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

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

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

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

    def to_a
      [name, type, value]
    end

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

    alias to_ary to_a
    alias to_hash to_h
  end

  private_constant :Data
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bcdd-result-0.8.0 lib/bcdd/result/data.rb
bcdd-result-0.7.0 lib/bcdd/result/data.rb
bcdd-result-0.6.0 lib/bcdd/result/data.rb
bcdd-result-0.5.0 lib/bcdd/result/data.rb