Class: Chartio::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/chartio/schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formatter, logger = STDOUT) ⇒ Schema

Returns a new instance of Schema.



9
10
11
12
# File 'lib/chartio/schema.rb', line 9

def initialize(formatter, logger = STDOUT)
  @formatter = formatter
  @logger    = logger
end

Instance Attribute Details

#formatterObject

Returns the value of attribute formatter.



7
8
9
# File 'lib/chartio/schema.rb', line 7

def formatter
  @formatter
end

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/chartio/schema.rb', line 7

def logger
  @logger
end

Instance Method Details

#output_reportObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/chartio/schema.rb', line 14

def output_report
  find_relationships do |record|
    begin
      @formatter << record
    rescue => e
      logger.puts "Encountered an error"
      logger.puts e.message
      logger.puts e.backtrace
    end
  end

  @formatter.output_report
end