Class: Box::Reader
- Inherits:
-
Object
- Object
- Box::Reader
- Defined in:
- lib/box/reader.rb
Instance Method Summary collapse
-
#initialize ⇒ Reader
constructor
A new instance of Reader.
- #load(data) ⇒ Object
- #read(path) ⇒ Object
- #unpack_data(data) ⇒ Object
Constructor Details
#initialize ⇒ Reader
Returns a new instance of Reader.
5 6 7 |
# File 'lib/box/reader.rb', line 5 def initialize @data = Hash.new end |
Instance Method Details
#load(data) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/box/reader.rb', line 18 def load(data) json = JSON.load(data) @data = unpack_data( json ) return @data end |
#read(path) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/box/reader.rb', line 25 def read(path) fp = File.new(path, "r") data = fp.read fp.close load data end |