Class: Schemify::Schema
- Inherits:
-
Object
- Object
- Schemify::Schema
- Includes:
- Vocabularies::Applicator::KeywordMethods, Vocabularies::Content::KeywordMethods, Vocabularies::Core::KeywordMethods, Vocabularies::FormatAnnotation::KeywordMethods, Vocabularies::MetaData::KeywordMethods, Vocabularies::Unevaluated::KeywordMethods, Vocabularies::Validation::KeywordMethods
- Defined in:
- lib/schemify/schema.rb
Overview
A JSON Schema representation
Instance Method Summary collapse
-
#initialize ⇒ Schema
constructor
A new instance of Schema.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Schema
Returns a new instance of Schema.
16 17 18 19 |
# File 'lib/schemify/schema.rb', line 16 def initialize(&) @keywords = {} instance_eval(&) if block_given? end |
Instance Method Details
#to_h ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/schemify/schema.rb', line 21 def to_h schema = {} @keywords.each_value do |keyword| schema.merge!(keyword.to_h) end schema end |