Sha256: 757713ae990322f35710775dae6192accfdb4f8c5b73a716e0aae44c46c45bda

Contents?: true

Size: 370 Bytes

Versions: 4

Compression:

Stored size: 370 Bytes

Contents

require 'faker'

module Restspec
  module Schema
    class AttributeExample < Struct.new(:attribute)
      def value
        if attribute.example.present?
          attribute.example.try(:call) || attribute.example
        else
          type.example_for(attribute)
        end
      end

      private

      def type
        attribute.type
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
restspec-0.0.4 lib/restspec/schema/attribute_example.rb
restspec-0.0.3 lib/restspec/schema/attribute_example.rb
restspec-0.0.2 lib/restspec/schema/attribute_example.rb
restspec-0.0.1 lib/restspec/schema/attribute_example.rb