Class: Schai::JsArray
- Inherits:
-
Object
- Object
- Schai::JsArray
- Defined in:
- lib/schai/json_schema/js_array.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#example ⇒ Object
Returns the value of attribute example.
-
#items ⇒ Object
Returns the value of attribute items.
-
#optional ⇒ Object
Returns the value of attribute optional.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ JsArray
constructor
A new instance of JsArray.
- #to_schema ⇒ Object
Constructor Details
#initialize(params) ⇒ JsArray
Returns a new instance of JsArray.
9 10 11 12 13 14 |
# File 'lib/schai/json_schema/js_array.rb', line 9 def initialize params @items = JsProperty.parse params['items'] @description = params["description"] @example = params["example"] @optional = params["optional"] end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/schai/json_schema/js_array.rb', line 3 def description @description end |
#example ⇒ Object
Returns the value of attribute example.
3 4 5 |
# File 'lib/schai/json_schema/js_array.rb', line 3 def example @example end |
#items ⇒ Object
Returns the value of attribute items.
3 4 5 |
# File 'lib/schai/json_schema/js_array.rb', line 3 def items @items end |
#optional ⇒ Object
Returns the value of attribute optional.
3 4 5 |
# File 'lib/schai/json_schema/js_array.rb', line 3 def optional @optional end |
Class Method Details
.parse(params) ⇒ Object
5 6 7 |
# File 'lib/schai/json_schema/js_array.rb', line 5 def self.parse params self.new params end |
Instance Method Details
#to_schema ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/schai/json_schema/js_array.rb', line 16 def to_schema schema = { type: :array, } schema[:description] = @description if @description schema[:items] = @items.to_schema schema[:example] = @example if @example schema end |