module MightyJSON::Types

Public Instance Methods

any() click to toggle source
# File lib/mighty_json/types.rb, line 33
def any
  MightyJSON::Type::Base.new(:any)
end
array(type = any) click to toggle source
# File lib/mighty_json/types.rb, line 9
def array(type = any)
  Type::Array.new(type)
end
array?(ty) click to toggle source
# File lib/mighty_json/types.rb, line 77
def array?(ty)
  optional(array(ty))
end
boolean() click to toggle source
# File lib/mighty_json/types.rb, line 29
def boolean
  MightyJSON::Type::Base.new(:boolean)
end
boolean?() click to toggle source
# File lib/mighty_json/types.rb, line 65
def boolean?
  optional(boolean)
end
enum(*types) click to toggle source
# File lib/mighty_json/types.rb, line 49
def enum(*types)
  MightyJSON::Type::Enum.new(types)
end
ignored() click to toggle source
# File lib/mighty_json/types.rb, line 73
def ignored
  MightyJSON::Type::Base.new(:ignored)
end
literal(value) click to toggle source
# File lib/mighty_json/types.rb, line 45
def literal(value)
  MightyJSON::Type::Literal.new(value)
end
literal?(value) click to toggle source
# File lib/mighty_json/types.rb, line 85
def literal?(value)
  optional(literal(value))
end
number() click to toggle source
# File lib/mighty_json/types.rb, line 25
def number
  MightyJSON::Type::Base.new(:number)
end
number?() click to toggle source
# File lib/mighty_json/types.rb, line 61
def number?
  optional(number)
end
numeric() click to toggle source
# File lib/mighty_json/types.rb, line 21
def numeric
  MightyJSON::Type::Base.new(:numeric)
end
numeric?() click to toggle source
# File lib/mighty_json/types.rb, line 57
def numeric?
  optional(numeric)
end
object(fields = {}) click to toggle source
# File lib/mighty_json/types.rb, line 5
def object(fields = {})
  Type::Object.new(fields)
end
object?(fields) click to toggle source
# File lib/mighty_json/types.rb, line 81
def object?(fields)
  optional(object(fields))
end
optional(type = any) click to toggle source
# File lib/mighty_json/types.rb, line 13
def optional(type = any)
  Type::Optional.new(type)
end
prohibited() click to toggle source
# File lib/mighty_json/types.rb, line 37
def prohibited
  MightyJSON::Type::Base.new(:prohibited)
end
string() click to toggle source
# File lib/mighty_json/types.rb, line 17
def string
  MightyJSON::Type::Base.new(:string)
end
string?() click to toggle source
# File lib/mighty_json/types.rb, line 53
def string?
  optional(string)
end
symbol() click to toggle source
# File lib/mighty_json/types.rb, line 41
def symbol
  MightyJSON::Type::Base.new(:symbol)
end
symbol?() click to toggle source
# File lib/mighty_json/types.rb, line 69
def symbol?
  optional(symbol)
end