Sha256: 3b8e2d7556f9b359665126d6a1923c76b96133f3899d3bbd89988a1ef730ae3b

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 Bytes

Contents

# frozen_string_literal: true

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

    def initialize(result)
      @name = result.send(:name)
      @type = result.type
      @value = result.value

      @to_h = { name: name, type: type, value: value }
      @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

1 entries across 1 versions & 1 rubygems

Version Path
bcdd-result-0.4.0 lib/bcdd/result/data.rb