Sha256: c15dc08c348b9ec8d736c120859af544eec560edf6a7d55a3e2bd7272c2cda7c

Contents?: true

Size: 436 Bytes

Versions: 11

Compression:

Stored size: 436 Bytes

Contents

module Spectifly
  module Json
    class Association < Spectifly::Base::Association
      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
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
spectifly-0.0.11 lib/spectifly/json/association.rb
spectifly-0.0.10 lib/spectifly/json/association.rb
spectifly-0.0.9 lib/spectifly/json/association.rb
spectifly-0.0.8 lib/spectifly/json/association.rb
spectifly-0.0.7 lib/spectifly/json/association.rb
spectifly-0.0.6 lib/spectifly/json/association.rb
spectifly-0.0.5 lib/spectifly/json/association.rb
spectifly-0.0.4 lib/spectifly/json/association.rb
spectifly-0.0.3 lib/spectifly/json/association.rb
spectifly-0.0.2 lib/spectifly/json/association.rb
spectifly-0.0.1 lib/spectifly/json/association.rb