Class: FFIDB::Typedef

Inherits:
Object
  • Object
show all
Includes:
Symbolic
Defined in:
lib/ffidb/typedef.rb

Instance Method Summary collapse

Methods included from Symbolic

#<=>, #enum?, #function?, #kind, #kind_weight, #struct?, #to_yaml, #union?

Constructor Details

#initialize(name, type, comment = nil) ⇒ Typedef



14
15
16
# File 'lib/ffidb/typedef.rb', line 14

def initialize(name, type, comment = nil)
  super(name.to_sym, Type.for(type), comment&.to_s)
end

Instance Method Details

#to_hHash<Symbol, Type>



30
31
32
33
34
35
36
# File 'lib/ffidb/typedef.rb', line 30

def to_h
  {
    name: self.name.to_s,
    type: self.type.to_s,
    comment: self.comment,
  }.delete_if { |k, v| v.nil? }
end

#to_sString



24
25
26
# File 'lib/ffidb/typedef.rb', line 24

def to_s
  "typedef #{self.type} #{self.name}"
end

#typedef?Boolean



20
# File 'lib/ffidb/typedef.rb', line 20

def typedef?() return true end