Class: Swagger::Schema::Content

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger/schema/content.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ Content

Returns a new instance of Content.



7
8
9
# File 'lib/swagger/schema/content.rb', line 7

def initialize(schema)
  @schema = schema
end

Class Method Details

.shortcut(name, type) ⇒ Object



16
17
18
# File 'lib/swagger/schema/content.rb', line 16

def self.shortcut(name, type)
  define_method(name) { self[type] }
end

Instance Method Details

#[](type) ⇒ Object



11
12
13
14
# File 'lib/swagger/schema/content.rb', line 11

def [](type)
  schema = Util.try_hash(@schema, type)
  MediaType.new(schema) if schema
end