Class: Swagger::V2::Example

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/swagger/v2/example.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#rawObject (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

#inspectObject



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