Class: JsonTestData::JsonSchema
- Inherits:
-
Object
- Object
- JsonTestData::JsonSchema
- Defined in:
- lib/json_test_data/json_schema.rb
Instance Attribute Summary collapse
-
#handler ⇒ Object
Returns the value of attribute handler.
-
#schema ⇒ Object
Returns the value of attribute schema.
Instance Method Summary collapse
- #generate_example ⇒ Object
-
#initialize(schema, handler = nil) ⇒ JsonSchema
constructor
A new instance of JsonSchema.
Constructor Details
#initialize(schema, handler = nil) ⇒ JsonSchema
Returns a new instance of JsonSchema.
8 9 10 11 |
# File 'lib/json_test_data/json_schema.rb', line 8 def initialize(schema, handler = nil) @schema = JSON.parse(schema, symbolize_names: true) @handler = handler end |
Instance Attribute Details
#handler ⇒ Object
Returns the value of attribute handler.
6 7 8 |
# File 'lib/json_test_data/json_schema.rb', line 6 def handler @handler end |
#schema ⇒ Object
Returns the value of attribute schema.
6 7 8 |
# File 'lib/json_test_data/json_schema.rb', line 6 def schema @schema end |
Instance Method Details
#generate_example ⇒ Object
13 14 15 |
# File 'lib/json_test_data/json_schema.rb', line 13 def generate_example generate(schema).to_json end |