Class: Compel::Builder::Schema
- Inherits:
-
Object
- Object
- Compel::Builder::Schema
- Includes:
- Common
- Defined in:
- lib/compel/builder/schema.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #default_value ⇒ Object
-
#initialize(type) ⇒ Schema
constructor
A new instance of Schema.
- #required? ⇒ Boolean
- #validate(object) ⇒ Object
Methods included from Common
Constructor Details
#initialize(type) ⇒ Schema
Returns a new instance of Schema.
11 12 13 14 |
# File 'lib/compel/builder/schema.rb', line 11 def initialize(type) @type = type = Hashie::Mash.new end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/compel/builder/schema.rb', line 8 def end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/compel/builder/schema.rb', line 8 def type @type end |
Instance Method Details
#default_value ⇒ Object
20 21 22 |
# File 'lib/compel/builder/schema.rb', line 20 def default_value [:default] end |
#required? ⇒ Boolean
16 17 18 |
# File 'lib/compel/builder/schema.rb', line 16 def required? !![:required] end |
#validate(object) ⇒ Object
24 25 26 |
# File 'lib/compel/builder/schema.rb', line 24 def validate(object) Contract.new(object, self).validate end |