Class: Restspec::Schema::AttributeExample

Inherits:
Struct
  • Object
show all
Defined in:
lib/restspec/schema/attribute_example.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributeObject

Returns the value of attribute attribute

Returns:

  • (Object)

    the current value of attribute



5
6
7
# File 'lib/restspec/schema/attribute_example.rb', line 5

def attribute
  @attribute
end

Instance Method Details

#valueObject



6
7
8
9
10
11
12
# File 'lib/restspec/schema/attribute_example.rb', line 6

def value
  if attribute.example.present?
    attribute.example.try(:call) || attribute.example
  else
    type.example_for(attribute)
  end
end