Class: DeepStruct::FileReader

Inherits:
Object
  • Object
show all
Defined in:
lib/deep_struct/file_reader.rb

Defined Under Namespace

Classes: UnknownFileFormat

Instance Method Summary collapse

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

#dataObject



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