Lurker News

Comments (61) 22 threads

Show all comments

Showing thread 15 of 22

dchuk1 reply#
Interesting to see that decent-sized list of languages without Ruby in it. Is there some technical limitation preventing ruby support?
Gehinnn1 reply#
It should work out of the box, but nobody confirmed yet that it works with ruby ;)
daviding1 reply#
In ruby if you have the right json schema set up it works. I'm not sure I completely grok yet how the data extractors would work on the ruby side yet though.

https://i.imgur.com/84mgPdF.jpg

Gehinnn1 reply#
Data Extractors usually need support from the extension. But you can configure how to construct the expression that is sent to the debugger to be evaluated. By default, it is `x => x`, but you could do `x => extract_json(x)`.
daviding3 replies#
Thanks, that works. I can put something simple in my settings.json like this

  "debugVisualizer.debugAdapterConfigurations": {
    "Ruby": {
      "expressionTemplate": "DataExtractor.to_table(${expr})",
    }
   },
..and something simple in the debugee like this..

  table_example =
    {"id"=> "1", "label"=> "One"},
    {"id"=> "2", "label"=> "Two"},
    {"id"=> "3", "label"=> "Three"}

  # Quick hash to visual table helper
  class DataExtractor
    def self.to_table(hash)
      meta_hash = {
        "kind" => {"table"=> true},
        "rows"=> hash
      }
      meta_hash.to_json
    end
  end
..and we get a decent hash or ActiveRecord visualizer. Thanks for the hint.

Continue this thread — 3 replies