Sha256: f95fb2bbfef97a0ee5c2226ce6548c638c560f7509d86e92ae3741e6c376e76a

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

# Base class for DAP enumerations
class DAP::Enum
  # Retreive an enumeration instance by value.
  # @param value [String] the enumeration string value
  # @return [Enum] the enumeration instance
  def self.from(value)
    values[value]
  end

  # The enumeration string value
  def to_s
    @value
  end

  # The enumeration string value, suitable for encoding
  def to_wire
    @value
  end

  private

  def self.new(value)
    super
  end

  def initialize(value)
    @value = value
    self.class.values[value] = self
  end

  def self.values
    @values ||= {}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-dap-0.1.3 lib/dap/enum.rb