module Jimmy::Macros

The Macros module includes methods that can be called directly on the Jimmy module for quickly making common types of schemas.

Public Instance Methods

nothing() click to toggle source

Make a schema that never validates. @return [Schema] The new schema.

# File lib/jimmy/macros.rb, line 20
def nothing
  schema.nothing
end
ref(uri) click to toggle source

Make a schema that references another schema by URI. @param [String, URI, Json::URI] uri @return [Schema] The new schema.

# File lib/jimmy/macros.rb, line 27
def ref(uri)
  schema.ref uri
end
schema(&block) click to toggle source

Make a new schema. Shortcut for Schema.new. @yieldparam schema [Schema] The new schema @return [Schema] The new schema.

# File lib/jimmy/macros.rb, line 14
def schema(&block)
  Schema.new &block
end

Private Instance Methods

get(*args, &block) click to toggle source
# File lib/jimmy/macros.rb, line 33
def get(*args, &block)
  {}.fetch(*args, &block)
end