Class: C::Union

Inherits:
Object
  • Object
show all
Defined in:
lib/cast-to-yaml/to_yaml.rb

Instance Method Summary collapse

Instance Method Details

#to_hObject



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/cast-to-yaml/to_yaml.rb', line 122

def to_h
  res = {}
  res["kind"] = "union"
  if name
    res["name"] = name
  else
    m = []
    members.each { |mem|
      m += mem.to_a
    }
    res["members"] = m
  end
  res["const"] = true if const?
  res["restrict"] = true if restrict?
  res["volatile"] = true if volatile?
  res
end