Class: StrongJSON

Inherits:
Object
  • Object
show all
Includes:
Types
Defined in:
lib/strong_json.rb,
lib/strong_json/type.rb,
lib/strong_json/types.rb,
lib/strong_json/version.rb,
lib/strong_json/error_reporter.rb

Defined Under Namespace

Modules: Type, Types Classes: ErrorReporter

Constant Summary collapse

VERSION =
"2.1.2"

Instance Method Summary collapse

Methods included from Types

#any, #any?, #array, #array?, #boolean, #boolean?, #enum, #enum?, #hash, #hash?, #integer, #integer?, #literal, #literal?, #number, #number?, #numeric, #numeric?, #object, #object?, #optional, #string, #string?, #symbol, #symbol?

Constructor Details

#initialize(&block) ⇒ StrongJSON

Returns a new instance of StrongJSON.



8
9
10
# File 'lib/strong_json.rb', line 8

def initialize(&block)
  instance_eval(&block)
end

Instance Method Details

#let(name, type) ⇒ Object



12
13
14
# File 'lib/strong_json.rb', line 12

def let(name, type)
  define_singleton_method(name) { type.with_alias(name) }
end