module JSON::Schema::Serializer::WithContext

Constants

ARG2_NOT_GIVEN

Public Instance Methods

with_context!(arg1, arg2 = ARG2_NOT_GIVEN) { || ... } click to toggle source
# File lib/json/schema/serializer.rb, line 27
def with_context!(arg1, arg2 = ARG2_NOT_GIVEN) # rubocop:disable Airbnb/OptArgParameters
  if block_given?
    DataWithContext.new(data: yield, context: arg1)
  elsif arg2 == ARG2_NOT_GIVEN
    DataWithContext.new(arg1)
  else
    DataWithContext.new(data: arg1, context: arg2)
  end
end