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

Defined Under Namespace

Modules: Type, Types

Constant Summary collapse

VERSION =
"0.9.0"

Instance Method Summary collapse

Methods included from Types

#any, #any?, #array, #array?, #boolean, #boolean?, #enum, #enum?, #ignored, #literal, #literal?, #number, #number?, #numeric, #numeric?, #object, #object?, #optional, #prohibited, #string, #string?, #symbol, #symbol?

Constructor Details

#initialize(&block) ⇒ StrongJSON

Returns a new instance of StrongJSON.



6
7
8
# File 'lib/strong_json.rb', line 6

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

Instance Method Details

#let(name, type) ⇒ Object



10
11
12
# File 'lib/strong_json.rb', line 10

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