Class: Jsapi::Meta::Defaults

Inherits:
Base::Model show all
Defined in:
lib/jsapi/meta/defaults.rb

Overview

Holds the default values for a particular Schema type.

Constant Summary

Constants included from Base::Attributes

Base::Attributes::DEFAULT_ARRAY, Base::Attributes::DEFAULT_HASH

Instance Method Summary collapse

Methods inherited from Base::Model

#initialize, #inspect, #merge!, #reference?, #resolve

Methods included from Base::Attributes

#attribute, #attribute_names

Constructor Details

This class inherits a constructor from Jsapi::Meta::Base::Model

Instance Method Details

#value(context:) ⇒ Object

Returns the default value within context.



18
19
20
21
22
23
24
25
# File 'lib/jsapi/meta/defaults.rb', line 18

def value(context:)
  case context
  when :request
    within_requests
  when :response
    within_responses
  end
end

#within_requestsObject

:attr: within_requests The default value of parameters and properties when reading requests.



10
# File 'lib/jsapi/meta/defaults.rb', line 10

attribute :within_requests

#within_responsesObject

:attr: within_responses The default value of properties when writing responses.



15
# File 'lib/jsapi/meta/defaults.rb', line 15

attribute :within_responses