Class: Ark::Schema
- Inherits:
-
Object
- Object
- Ark::Schema
- Includes:
- Validations::Schema
- Defined in:
- lib/ark/schema.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#parsed_schema ⇒ Object
readonly
Returns the value of attribute parsed_schema.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Schema
constructor
A new instance of Schema.
- #save ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
6 7 8 |
# File 'lib/ark/schema.rb', line 6 def db @db end |
#definition ⇒ Object
Returns the value of attribute definition.
5 6 7 |
# File 'lib/ark/schema.rb', line 5 def definition @definition end |
#errors ⇒ Object
Returns the value of attribute errors.
5 6 7 |
# File 'lib/ark/schema.rb', line 5 def errors @errors end |
#parsed_schema ⇒ Object (readonly)
Returns the value of attribute parsed_schema.
6 7 8 |
# File 'lib/ark/schema.rb', line 6 def parsed_schema @parsed_schema end |
Class Method Details
.add(definition) ⇒ Object
10 11 12 13 14 |
# File 'lib/ark/schema.rb', line 10 def add(definition) s = self.new s.definition = definition s.save end |
.basepath ⇒ Object
16 17 18 |
# File 'lib/ark/schema.rb', line 16 def basepath "_schema" end |
Instance Method Details
#save ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/ark/schema.rb', line 30 def save if valid? @db.set("#{self.class.basepath}/#{@parsed_schema['id']}.json", @definition, "Adding schema - #{@parsed_schema['id']}") else false end end |
#valid? ⇒ Boolean
26 27 28 |
# File 'lib/ark/schema.rb', line 26 def valid? validate_schema end |