Class: DeepStruct::FileReader
- Inherits:
-
Object
- Object
- DeepStruct::FileReader
- Defined in:
- lib/deep_struct/file_reader.rb
Defined Under Namespace
Classes: UnknownFileFormat
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(path) ⇒ FileReader
constructor
A new instance of FileReader.
Constructor Details
#initialize(path) ⇒ FileReader
Returns a new instance of FileReader.
4 5 6 7 8 |
# File 'lib/deep_struct/file_reader.rb', line 4 def initialize(path) @path = path @type = extract_type bad_type! unless @type end |
Instance Method Details
#data ⇒ Object
10 11 12 13 14 |
# File 'lib/deep_struct/file_reader.rb', line 10 def data send("read_#{@type}_file") rescue NoMethodError bad_type! end |