module RatPackSwagger::SwaggerType

Public Instance Methods

to_h() click to toggle source
# File lib/swagger_spec.rb, line 5
def to_h
  h = {}
  getters = methods.select{|m| m =~ /\w+=$/}.map{|m| m.to_s.chop}
  getters.each do |getter|
    val = send(getter)
    next if [nil, [], {}].include?(val)
    val = val.to_h if val.is_a?(SwaggerType)
    h[getter.to_sym] = val
  end
  return h
end