Class: ConceptQL::Debugger
- Inherits:
-
Object
- Object
- ConceptQL::Debugger
- Defined in:
- lib/conceptql/debugger.rb
Instance Attribute Summary collapse
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
-
#watch_ids ⇒ Object
readonly
Returns the value of attribute watch_ids.
Instance Method Summary collapse
- #capture_results(path) ⇒ Object
-
#initialize(statement, opts = {}) ⇒ Debugger
constructor
A new instance of Debugger.
Constructor Details
#initialize(statement, opts = {}) ⇒ Debugger
Returns a new instance of Debugger.
8 9 10 11 12 13 14 15 |
# File 'lib/conceptql/debugger.rb', line 8 def initialize(statement, opts = {}) @statement = statement @db = opts.fetch(:db, nil) @tree = opts.fetch(:tree, Tree.new) ConceptQL::Operators::Operator.send(:include, ConceptQL::Behaviors::Debuggable) @watch_ids = opts.fetch(:watch_ids, []) raise "Please specify one or more person_ids you'd like to debug" unless @watch_ids end |
Instance Attribute Details
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
7 8 9 |
# File 'lib/conceptql/debugger.rb', line 7 def statement @statement end |
#watch_ids ⇒ Object (readonly)
Returns the value of attribute watch_ids.
7 8 9 |
# File 'lib/conceptql/debugger.rb', line 7 def watch_ids @watch_ids end |
Instance Method Details
#capture_results(path) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/conceptql/debugger.rb', line 17 def capture_results(path) raise "Please specify path for debug file" unless path Dir.mktmpdir do |dir| dir = Pathname.new(dir) operators = tree.root(self) operators.first.reset_operator_number csv_files = operators.map.with_index do |last_operator, index| last_operator.print_results(db, dir, watch_ids) end.flatten system("csv2xlsx #{path} #{csv_files.join(' ')}") end end |