Class: Freesound::ResponseParser
- Inherits:
-
Object
- Object
- Freesound::ResponseParser
- Defined in:
- lib/freesound/response_parser.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
Instance Method Summary collapse
-
#initialize(form) ⇒ ResponseParser
constructor
A new instance of ResponseParser.
- #parse(raw) ⇒ Object
Constructor Details
#initialize(form) ⇒ ResponseParser
Returns a new instance of ResponseParser.
5 6 7 |
# File 'lib/freesound/response_parser.rb', line 5 def initialize(form) @format = form end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
3 4 5 |
# File 'lib/freesound/response_parser.rb', line 3 def format @format end |
Instance Method Details
#parse(raw) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/freesound/response_parser.rb', line 9 def parse(raw) case @format when :xml parse_xml(raw) when :yaml, :yml parse_yaml(raw) else parse_json(raw) end end |