Module: Kwalify
- Extended by:
- ErrorHelper, TypeHelper
- Defined in:
- lib/kwalify/messages.rb,
lib/kwalify.rb,
lib/kwalify/rule.rb,
lib/kwalify/types.rb,
lib/kwalify/types.rb,
lib/kwalify/types.rb,
lib/kwalify/types.rb,
lib/kwalify/types.rb,
lib/kwalify/errors.rb,
lib/kwalify/parser.rb,
lib/kwalify/validator.rb,
lib/kwalify/main-program.rb,
lib/kwalify/meta-validator.rb
Overview
$Rev: 22 $ $Release: 0.4.0 $ copyright© 2005 kuwata-lab all rights reserved.
Defined Under Namespace
Modules: Boolean, ErrorHelper, Scalar, Text, TypeHelper
Classes: AssertionError, BaseError, KwalifyError, MainProgram, MetaValidator, ParseError, Parser, PlainParser, Rule, SchemaError, ValidationError, Validator
Constant Summary
collapse
- RELEASE =
("$Release: 0.4.0 $" =~ /[.\d]+/) && $&
- DEFAULT_TYPE =
use “str” as default of @type
"str"
- META_SCHEMA =
<<'END'
name: MAIN
type: map
required: yes
mapping: &main-rule
"name":
type: str
"desc":
type: str
"type":
type: str
#required: yes
enum:
- seq
#- sequence
#- list
- map
#- mapping
#- hash
- str
#- string
- int
#- integer
- float
- number
#- numeric
- bool
#- boolean
- text
- date
- time
- timestamp
#- object
- any
- scalar
#- collection
"required":
type: bool
"enum":
type: seq
sequence:
- type: scalar
"pattern":
type: str
"assert":
type: str
pattern: /\bval\b/
"range":
type: map
mapping:
"max":
type: scalar
"min":
type: scalar
"max-ex":
type: scalar
"min-ex":
type: scalar
#complement":
# type: boolean
"length":
type: map
mapping:
"max":
type: int
"min":
type: int
"max-ex":
type: int
"min-ex":
type: int
"ident":
type: bool
"unique":
type: bool
"sequence":
name: SEQUENCE
type: seq
sequence:
- type: map
mapping: *main-rule
name: MAIN
#required: yes
"mapping":
name: MAPPING
type: map
mapping:
=:
type: map
mapping: *main-rule
name: MAIN
#required: yes
END
- META_VALIDATOR =
MetaValidator.new(schema)
- @@type_table =
{
"seq" => Array,
"map" => Hash,
"str" => String,
"text" => Text,
"int" => Integer,
"float" => Float,
"number" => Numeric,
"date" => Date,
"time" => Time,
"timestamp" => Time,
"bool" => Boolean,
"any" => Object,
"scalar" => Scalar,
}
- @@messages =
{}
- @@words =
{}
Class Method Summary
collapse
Methods included from TypeHelper
collection?, scalar?
_create_error, assert_error, schema_error, validate_error
Class Method Details
.get_type_class(type) ⇒ Object
109
110
111
112
113
|
# File 'lib/kwalify/types.rb', line 109
def self.get_type_class(type)
klass = @@type_table[type]
return klass
end
|
310
311
312
|
# File 'lib/kwalify/meta-validator.rb', line 310
def self.meta_validator
return META_VALIDATOR
end
|
.msg(key) ⇒ Object
11
12
13
|
# File 'lib/kwalify/messages.rb', line 11
def self.msg(key)
return @@messages[key]
end
|
.type_table ⇒ Object
105
106
107
|
# File 'lib/kwalify/types.rb', line 105
def self.type_table
return @@type_table
end
|
.word(key) ⇒ Object
97
98
99
|
# File 'lib/kwalify/messages.rb', line 97
def self.word(key)
return @@words[key] || key
end
|