Class: FFIDB::Enum
Instance Method Summary
collapse
Methods included from Symbolic
#<=>, #function?, #kind, #kind_weight, #struct?, #to_yaml, #typedef?, #union?
Constructor Details
#initialize(name, values = {}, comment = nil) ⇒ Enum
Returns a new instance of Enum.
13
14
15
|
# File 'lib/ffidb/enum.rb', line 13
def initialize(name, values = {}, = nil)
super(name.to_sym, values || {}, &.to_s)
end
|
Instance Method Details
#enum? ⇒ Boolean
19
|
# File 'lib/ffidb/enum.rb', line 19
def enum?() return true end
|
#to_h ⇒ Hash<Symbol, Type>
29
30
31
32
33
34
35
|
# File 'lib/ffidb/enum.rb', line 29
def to_h
{
name: self.name.to_s,
comment: self.,
values: self.values,
}.delete_if { |k, v| v.nil? }
end
|
#to_s ⇒ String
23
24
25
|
# File 'lib/ffidb/enum.rb', line 23
def to_s
"enum #{self.name}"
end
|