sig/strong_json.rbs in strong_json-2.1.1 vs sig/strong_json.rbs in strong_json-2.1.2

- old
+ new

@@ -1,67 +1,67 @@ class StrongJSON def initialize: { (StrongJSON) -> void } -> untyped def let: (Symbol, ty) -> void - include StrongJSON::Types -end + include Types -StrongJSON::VERSION: String + VERSION: String -interface StrongJSON::_Schema[T] - def coerce: (untyped, ?path: Type::ErrorPath) -> T - def =~: (untyped) -> bool - def to_s: -> String - def is_a?: (untyped) -> bool - def `alias`: -> Symbol? - def with_alias: (Symbol) -> self - def ==: (untyped) -> bool - def yield_self: [X] () { (self) -> X } -> X -end + interface _Schema[T] + def coerce: (untyped, ?path: Type::ErrorPath) -> T + def =~: (untyped) -> bool + def to_s: -> String + def is_a?: (untyped) -> bool + def `alias`: -> Symbol? + def with_alias: (Symbol) -> self + def ==: (untyped) -> bool + def yield_self: [X] () { (self) -> X } -> X + end -type StrongJSON::ty = _Schema[untyped] + type ty = _Schema[untyped] -module StrongJSON::Types - def object: [X] (Hash[Symbol, ty]) -> Type::Object[X] - | () -> Type::Object[bot] - def object?: [X] (Hash[Symbol, ty]) -> Type::Optional[X] - | () -> Type::Optional[bot] - def any: () -> Type::Base[untyped] - def any?: () -> Type::Optional[untyped] - def optional: [X] (_Schema[X]) -> Type::Optional[X] - | () -> Type::Optional[untyped] - def string: () -> Type::Base[String] - def string?: () -> Type::Optional[String] - def number: () -> Type::Base[Numeric] - def number?: () -> Type::Optional[Numeric] - def numeric: () -> Type::Base[Numeric] - def numeric?: () -> Type::Optional[Numeric] - def integer: () -> Type::Base[Integer] - def integer?: () -> Type::Optional[Integer] - def boolean: () -> Type::Base[bool] - def boolean?: () -> Type::Optional[bool] - def symbol: () -> Type::Base[Symbol] - def symbol?: () -> Type::Optional[Symbol] - def array: [X] (_Schema[X]) -> Type::Array[X] - | () -> Type::Array[untyped] - def array?: [X] (_Schema[X]) -> Type::Optional[::Array[X]] - def literal: [X] (X) -> Type::Literal[X] - def literal?: [X] (X) -> Type::Optional[X] - def enum: [X] (*_Schema[untyped], ?detector: Type::detector?) -> Type::Enum[X] - def enum?: [X] (*_Schema[untyped], ?detector: Type::detector?) -> Type::Optional[X] - incompatible def hash: [X] (_Schema[X]) -> Type::Hash[X] - def hash?: [X] (_Schema[X]) -> Type::Optional[Hash[Symbol, X]] -end + module Types + def object: [X] (Hash[Symbol, ty]) -> Type::Object[X] + | () -> Type::Object[bot] + def object?: [X] (Hash[Symbol, ty]) -> Type::Optional[X] + | () -> Type::Optional[bot] + def any: () -> Type::Base[untyped] + def any?: () -> Type::Optional[untyped] + def optional: [X] (_Schema[X]) -> Type::Optional[X] + | () -> Type::Optional[untyped] + def string: () -> Type::Base[String] + def string?: () -> Type::Optional[String] + def number: () -> Type::Base[Numeric] + def number?: () -> Type::Optional[Numeric] + def numeric: () -> Type::Base[Numeric] + def numeric?: () -> Type::Optional[Numeric] + def integer: () -> Type::Base[Integer] + def integer?: () -> Type::Optional[Integer] + def boolean: () -> Type::Base[bool] + def boolean?: () -> Type::Optional[bool] + def symbol: () -> Type::Base[Symbol] + def symbol?: () -> Type::Optional[Symbol] + def array: [X] (_Schema[X]) -> Type::Array[X] + | () -> Type::Array[untyped] + def array?: [X] (_Schema[X]) -> Type::Optional[::Array[X]] + def literal: [X] (X) -> Type::Literal[X] + def literal?: [X] (X) -> Type::Optional[X] + def enum: [X] (*_Schema[untyped], ?detector: Type::detector?) -> Type::Enum[X] + def enum?: [X] (*_Schema[untyped], ?detector: Type::detector?) -> Type::Optional[X] + def hash: [X] (_Schema[X]) -> Type::Hash[X] + def hash?: [X] (_Schema[X]) -> Type::Optional[Hash[Symbol, X]] + end -class StrongJSON::ErrorReporter - attr_reader path: Type::ErrorPath - @string: String + class ErrorReporter + attr_reader path: Type::ErrorPath + @string: String - def initialize: (path: Type::ErrorPath) -> untyped - def format: -> void - def pretty_str: (ty, ?expand_alias: bool) -> ::String + def initialize: (path: Type::ErrorPath) -> untyped + def format: -> void + def pretty_str: (ty, ?expand_alias: bool) -> ::String - private - def format_trace: (path: Type::ErrorPath, ?index: Integer) -> void - def format_aliases: (path: Type::ErrorPath, where: ::Array[String]) -> ::Array[String] - def format_single_alias: (Symbol, ty) -> String - def pretty: (ty, untyped, ?expand_alias: bool) -> void + private + def format_trace: (path: Type::ErrorPath, ?index: Integer) -> void + def format_aliases: (path: Type::ErrorPath, where: ::Array[String]) -> ::Array[String] + def format_single_alias: (Symbol, ty) -> String + def pretty: (ty, PrettyPrint, ?expand_alias: bool) -> void + end end