Class: Swagger::Base
- Inherits:
-
Object
- Object
- Swagger::Base
- Includes:
- RackHelpers
- Defined in:
- lib/swagger/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(data) ⇒ Base
constructor
A new instance of Base.
Methods included from RackHelpers
Constructor Details
#initialize(data) ⇒ Base
Returns a new instance of Base.
28 29 30 31 |
# File 'lib/swagger/base.rb', line 28 def initialize(data) @spec = data JSON::Validator.validate!({ "$ref" => "http://swagger.io/v2/schema.json#" }, @spec) end |
Class Method Details
.from_file(filepath) ⇒ Object
33 34 35 |
# File 'lib/swagger/base.rb', line 33 def self.from_file(filepath) new(YAML.load(open(filepath))) end |
Instance Method Details
#[](key) ⇒ Object
37 38 39 |
# File 'lib/swagger/base.rb', line 37 def [](key) @spec[key] end |