Class: MediaType
- Inherits:
-
Object
- Object
- MediaType
- Defined in:
- lib/tiki/media-type.rb
Instance Method Summary collapse
-
#initialize(schema: :object, ref: nil) ⇒ MediaType
constructor
A new instance of MediaType.
- #schema(type = :object, title = nil, ref: nil, &block) ⇒ Object
- #to_spec ⇒ Object
Constructor Details
Instance Method Details
#schema(type = :object, title = nil, ref: nil, &block) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/tiki/media-type.rb', line 18 def schema(type = :object, title = nil, ref: nil, &block) if ref @schema = Reference.new ref else @schema = Schema.new type, title @schema.instance_eval(&block) if block end end |
#to_spec ⇒ Object
27 28 29 30 31 |
# File 'lib/tiki/media-type.rb', line 27 def to_spec props = {} props[:schema] = @schema.to_spec if @schema props end |