Class: Swagger::Base
- Inherits:
-
Object
- Object
- Swagger::Base
- Includes:
- RackHelpers
- Defined in:
- lib/swagger/base.rb
Instance Attribute Summary collapse
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
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.
30 31 32 33 |
# File 'lib/swagger/base.rb', line 30 def initialize(data) @spec = data JSON::Validator.validate!({ "$ref" => "http://swagger.io/v2/schema.json#" }, @spec) end |
Instance Attribute Details
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
22 23 24 |
# File 'lib/swagger/base.rb', line 22 def spec @spec end |
Class Method Details
.from_file(filepath) ⇒ Object
35 36 37 |
# File 'lib/swagger/base.rb', line 35 def self.from_file(filepath) new(YAML.load(open(filepath))) end |
Instance Method Details
#[](key) ⇒ Object
39 40 41 |
# File 'lib/swagger/base.rb', line 39 def [](key) @spec[key] end |