Class: Thinreports::SectionReport::Schema::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/thinreports/section_report/schema/loader.rb

Instance Method Summary collapse

Constructor Details

#initializeLoader

Returns a new instance of Loader.



9
10
11
# File 'lib/thinreports/section_report/schema/loader.rb', line 9

def initialize
  @parser = Schema::Parser.new
end

Instance Method Details

#load_from_data(data) ⇒ Object



18
19
20
# File 'lib/thinreports/section_report/schema/loader.rb', line 18

def load_from_data(data)
  parser.parse(data)
end

#load_from_file(filename) ⇒ Object



13
14
15
16
# File 'lib/thinreports/section_report/schema/loader.rb', line 13

def load_from_file(filename)
  data = File.read(filename, encoding: 'UTF-8')
  load_from_data(data)
end