Module: RatPackSwagger::SwaggerType

Included in:
SwaggerOperation, SwaggerPathItem
Defined in:
lib/swagger_spec.rb

Instance Method Summary collapse

Instance Method Details

#to_hObject



5
6
7
8
9
10
11
12
13
14
15
# 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