Class: Swagger::V2::Example
- Inherits:
-
Object
- Object
- Swagger::V2::Example
- Extended by:
- Forwardable
- Defined in:
- lib/swagger/v2/example.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(sample) ⇒ Example
constructor
A new instance of Example.
- #inspect ⇒ Object
- #parse(_format = :json) ⇒ Object
Constructor Details
#initialize(sample) ⇒ Example
Returns a new instance of Example.
9 10 11 |
# File 'lib/swagger/v2/example.rb', line 9 def initialize(sample) @raw = sample end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
7 8 9 |
# File 'lib/swagger/v2/example.rb', line 7 def raw @raw end |
Instance Method Details
#inspect ⇒ Object
19 20 21 |
# File 'lib/swagger/v2/example.rb', line 19 def inspect @raw.inspect end |
#parse(_format = :json) ⇒ Object
13 14 15 16 17 |
# File 'lib/swagger/v2/example.rb', line 13 def parse(_format = :json) return @raw unless @raw.is_a? String JSON.parse(@raw) end |