Class: SexyJSONSchemas::Properties::Base
- Inherits:
-
Object
- Object
- SexyJSONSchemas::Properties::Base
- Defined in:
- lib/sexy_json_schemas/properties/base.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(name, options = {}) ⇒ Base
constructor
A new instance of Base.
- #type ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Base
Returns a new instance of Base.
6 7 8 9 |
# File 'lib/sexy_json_schemas/properties/base.rb', line 6 def initialize(name, = {}) @name = name @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/sexy_json_schemas/properties/base.rb', line 4 def name @name end |
Instance Method Details
#as_json ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/sexy_json_schemas/properties/base.rb', line 15 def as_json json = { } json["type"] = type if type if @options[:required] json['required'] = true end if @options[:enum] json['enum'] = @options[:enum] end if @options[:format] json['format'] = @options[:format] end if @options[:description] json['description'] = @options[:description] end json end |
#type ⇒ Object
11 12 13 |
# File 'lib/sexy_json_schemas/properties/base.rb', line 11 def type nil end |