Class: Compel::Contract

Inherits:
Object
  • Object
show all
Defined in:
lib/compel/contract.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, schema) ⇒ Contract

Returns a new instance of Contract.



7
8
9
10
# File 'lib/compel/contract.rb', line 7

def initialize(object, schema)
  @object = object
  @schema = schema
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



5
6
7
# File 'lib/compel/contract.rb', line 5

def object
  @object
end

#schemaObject (readonly)

Returns the value of attribute schema.



5
6
7
# File 'lib/compel/contract.rb', line 5

def schema
  @schema
end

Instance Method Details

#validateObject



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

def validate
  Result.new(setup!.validate)
end