Class: C::Array

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

Instance Method Summary collapse

Instance Method Details

#to_h(declaration = nil) ⇒ Object



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/cast-to-yaml/to_yaml.rb', line 221

def to_h(declaration = nil)
  res = {}
  res["kind"] = "array"
  if type
    if declaration
      res["type"] = type.to_h(declaration)
    else
      res["type"] = type.to_h
    end
  else
    res["type"] = declaration.type.to_h
  end
  if length
    res["length"] = length.to_s
  end
  res
end