class Schash::Schema::DSL
Public Class Methods
evaluate(&block)
click to toggle source
# File lib/schash/schema/dsl.rb, line 4 def self.evaluate(&block) self.new.instance_eval(&block) end
Public Instance Methods
array()
click to toggle source
# File lib/schash/schema/dsl.rb, line 44 def array type(Array) end
array_of(schema)
click to toggle source
# File lib/schash/schema/dsl.rb, line 8 def array_of(schema) Rule::ArrayOf.new(schema) end
boolean()
click to toggle source
# File lib/schash/schema/dsl.rb, line 48 def boolean one_of_types(TrueClass, FalseClass) end
float()
click to toggle source
# File lib/schash/schema/dsl.rb, line 36 def float type(Float) end
integer()
click to toggle source
# File lib/schash/schema/dsl.rb, line 32 def integer type(Integer) end
match(pattern)
click to toggle source
# File lib/schash/schema/dsl.rb, line 52 def match(pattern) Rule::Match.new(pattern) end
numeric()
click to toggle source
# File lib/schash/schema/dsl.rb, line 28 def numeric type(Numeric) end
one_of_types(*schemas)
click to toggle source
# File lib/schash/schema/dsl.rb, line 12 def one_of_types(*schemas) Rule::OneOfTypes.new(*schemas) end
optional(rule)
click to toggle source
# File lib/schash/schema/dsl.rb, line 20 def optional(rule) Rule::Optional.new(rule) end
string()
click to toggle source
# File lib/schash/schema/dsl.rb, line 24 def string type(String) end
symbol()
click to toggle source
# File lib/schash/schema/dsl.rb, line 40 def symbol type(Symbol) end
type(klass)
click to toggle source
# File lib/schash/schema/dsl.rb, line 16 def type(klass) Rule::Type.new(klass) end