Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
Update README to reflect that validate now throws.
Browse files Browse the repository at this point in the history
Change-Id: Ife69805a1e3948533bf0b604d0d62dacbbd02041
  • Loading branch information
mpage committed May 1, 2012
1 parent 5536744 commit ee8ef23
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Expand Up @@ -26,14 +26,14 @@ by default. The provided schemas are:
schemas. Similar to a sum type.
* _List_ - Accepts arrays where each element of the array validates
against a supplied schema.
* _Record_ - Accepts hashes with known keys. Each key has a supplied schema
and against which its value must validate.
* _Record_ - Accepts hashes with known keys. Each key has a supplied schema,
against which its value must validate.
* _Value_ - Accepts values using ```==```.

## Usage

Membrane schemas are typically created using a concise DSL. For example, the
following creates a schema that will validate a hash expecting the key "ints"
following creates a schema that will validate a hash where the key "ints"
maps to a list of integers and the key "string" maps to a string.

schema = Membrane::SchemaParser.parse do
Expand Down Expand Up @@ -74,10 +74,12 @@ can be used as a schema:

# @param [Object] The object being validated.
#
# @return [String, nil] On success, nil is returned. On failure, a
# description of the validation error is returned.
# @raise [Membrane::SchemaValidationError] Raised when a supplied object is
# invalid.
#
# @return [nil]
def validate(object)

If you wish to include your new schema as part of the DSL, you'll need to
modify ```membrane/schema_parser.rb``` and have your class inherit from
```Membrane::Schema::Base```.
```Membrane::Schema::Base```

0 comments on commit ee8ef23

Please sign in to comment.