Class: SimpleSchema::Schema
- Inherits:
-
Object
- Object
- SimpleSchema::Schema
- Defined in:
- lib/simple_schema/schema.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
-
#initialize(defined_schema, options = {}) ⇒ Schema
constructor
A new instance of Schema.
Constructor Details
#initialize(defined_schema, options = {}) ⇒ Schema
Returns a new instance of Schema.
5 6 7 8 9 10 11 |
# File 'lib/simple_schema/schema.rb', line 5 def initialize(defined_schema, = {}) [:normalizers] ||= [SchemaItems, SchemaProperties] [:defaults] ||= {:required => true, :type => :string} raise InvalidSchemaType.new(defined_schema.class) unless defined_schema.is_a?(Hash) || defined_schema.is_a?(Array) @options = @schema = normalize(defined_schema) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/simple_schema/schema.rb', line 3 def @options end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
3 4 5 |
# File 'lib/simple_schema/schema.rb', line 3 def schema @schema end |