Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/rubygems_herald/spider.rb
Instance Method Summary collapse
Instance Method Details
#is_json? ⇒ Boolean
37 38 39 40 41 42 43 |
# File 'lib/rubygems_herald/spider.rb', line 37 def is_json? begin !!JSON.parse(self) rescue false end end |
#parse_json ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/rubygems_herald/spider.rb', line 45 def parse_json if is_json? JSON.parse self else raise :invalid_json_response.l + ': ' + self end end |