Module: JSI::Schema::Application::ChildApplication

Included in:
Draft04, Draft06, Draft07
Defined in:
lib/jsi/schema/application/child_application.rb

Defined Under Namespace

Modules: Contains, Draft04, Draft06, Draft07, Items, Properties

Instance Method Summary collapse

Instance Method Details

#child_applicator_schemas(token, instance) ⇒ JSI::SchemaSet

a set of child applicator subschemas of this schema which apply to the child of the given instance on the given token.

Parameters:

  • token (Object)

    the array index or object property name for the child instance

  • instance (Object)

    the instance to check any child applicators against

Returns:

  • (JSI::SchemaSet)

    child applicator subschemas of this schema for the given token of the instance


20
21
22
# File 'lib/jsi/schema/application/child_application.rb', line 20

def child_applicator_schemas(token, instance)
  SchemaSet.new(each_child_applicator_schema(token, instance))
end

#each_child_applicator_schema(token, instance) {|JSI::Schema| ... } ⇒ nil, Enumerator

yields each child applicator subschema (from properties, items, etc.) which applies to the child of the given instance on the given token.

Parameters:

  • token (Object)

    the array index or object property name for the child instance

  • instance (Object)

    the instance to check any child applicators against

Yields:

Returns:

  • (nil, Enumerator)

    an Enumerator if invoked without a block; otherwise nil


30
31
32
33
34
35
36
37
38
# File 'lib/jsi/schema/application/child_application.rb', line 30

def each_child_applicator_schema(token, instance, &block)
  return to_enum(__method__, token, instance) unless block

  if schema_content.respond_to?(:to_hash)
    internal_child_applicate_keywords(token, instance, &block)
  end

  nil
end