class Spectifly::Json::Association

Public Instance Methods

to_h() click to toggle source
# File lib/spectifly/json/association.rb, line 4
def to_h
  fields = {
    :type => type,
    :required => required?,
  }
  [:description, :example, :restrictions].each do |opt|
    value = self.send(opt)
    if value && !value.empty?
      fields[opt] = value
    end
  end
  { name.to_sym => fields}
end