Class: Hub::JSON
- Inherits:
-
Object
- Object
- Hub::JSON
- Extended by:
- Forwardable, Generator
- Defined in:
- lib/hub/json.rb
Overview
Stupid pure Ruby JSON parser.
Defined Under Namespace
Modules: Generator
Constant Summary collapse
- WSP =
/\s+/- OBJ =
/[{\[]/- HEN =
/\}/- AEN =
/\]/- COL =
/\s*:\s*/- KEY =
/\s*,\s*/- NUM =
/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/- BOL =
/true|false/- NUL =
/null/
Instance Attribute Summary collapse
-
#scanner ⇒ Object
(also: #s)
readonly
Returns the value of attribute scanner.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ JSON
constructor
A new instance of JSON.
- #parse ⇒ Object
Methods included from Generator
Constructor Details
#initialize(data) ⇒ JSON
Returns a new instance of JSON.
21 22 23 |
# File 'lib/hub/json.rb', line 21 def initialize data @scanner = StringScanner.new data.to_s end |
Instance Attribute Details
#scanner ⇒ Object (readonly) Also known as: s
Returns the value of attribute scanner.
16 17 18 |
# File 'lib/hub/json.rb', line 16 def scanner @scanner end |
Class Method Details
.parse(data) ⇒ Object
6 |
# File 'lib/hub/json.rb', line 6 def self.parse(data) new(data).parse end |
Instance Method Details
#parse ⇒ Object
25 26 27 28 |
# File 'lib/hub/json.rb', line 25 def parse space object end |