Sha256: 28d1b0400086b5fbdcec4e0bf850a32b3fd0e81ad6b8ff1d3a37c1f8931de9ef
Contents?: true
Size: 799 Bytes
Versions: 2
Compression:
Stored size: 799 Bytes
Contents
# This is free and unencumbered software released into the public domain. require_relative 'symbolic' module FFIDB class Enum < ::Struct.new(:name, :values, :comment) include Symbolic ## # @param [Symbol, #to_sym] name # @param [Map<String, Integer>] values # @param [String, #to_s] comment def initialize(name, values = {}, comment = nil) super(name.to_sym, values || {}, comment&.to_s) end ## # @return [Boolean] def enum?() return true end ## # @return [String] def to_s "enum #{self.name}" end ## # @return [Hash<Symbol, Type>] def to_h { name: self.name.to_s, comment: self.comment, values: self.values, }.delete_if { |k, v| v.nil? } end end # Enum end # FFIDB
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ffidb-0.13.0 | lib/ffidb/enum.rb |
ffidb-0.12.0 | lib/ffidb/enum.rb |