Class: CollectionJson::Rack::Parser
- Inherits:
-
Object
- Object
- CollectionJson::Rack::Parser
- Defined in:
- lib/collection_json/rack/parser.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
Instance Method Summary collapse
-
#initialize(json_string) ⇒ Parser
constructor
A new instance of Parser.
- #valid? ⇒ Boolean
Constructor Details
#initialize(json_string) ⇒ Parser
Returns a new instance of Parser.
5 6 7 8 9 |
# File 'lib/collection_json/rack/parser.rb', line 5 def initialize json_string @json = JSON.parse json_string rescue JSON::ParserError => e raise CollectionJson::InvalidJsonError.new "Couldn't parse: <#{json_string}>, #{e.}" end |
Instance Attribute Details
#json ⇒ Object (readonly)
Returns the value of attribute json.
3 4 5 |
# File 'lib/collection_json/rack/parser.rb', line 3 def json @json end |
Instance Method Details
#valid? ⇒ Boolean
11 12 13 |
# File 'lib/collection_json/rack/parser.rb', line 11 def valid? false end |