Skip to content
Josh Cheek edited this page Jan 8, 2017 · 1 revision

Get a help screen with all of the options: bin/seeing_is_believing -h

Get examples the options: bin/seeing_is_believing -h+


Given the file simple_example.rb

5.times do |i|
  i * 2
end

$ seeing_is_believing simple_example.rb will print:

5.times do |i|  # => 5
  i * 2         # => 0, 2, 4, 6, 8
end             # => 5

$ seeing_is_believing simple_example.rb --json will print:

{"stdout":"","stderr":"","exitstatus":0,"exception":null,"lines":{"1":["5"],"2":["0","2","4","6","8"],"3":["5"]}}

$ seeing_is_believing simple_example.rb --stream will print each result as it is seen. You could use this to dynamically update results in your editor independent of the comments:

["ruby_version",{"value":"2.4.0"}]
["sib_version",{"value":"3.1.1"}]
["filename",{"value":"simple_example.rb"}]
["num_lines",{"value":3}]
["max_line_captures",{"value":-1,"is_infinity":true}]
["line_result",{"type":"inspect","line_number":1,"inspected":"5"}]
["line_result",{"type":"inspect","line_number":2,"inspected":"0"}]
["line_result",{"type":"inspect","line_number":2,"inspected":"2"}]
["line_result",{"type":"inspect","line_number":2,"inspected":"4"}]
["line_result",{"type":"inspect","line_number":2,"inspected":"6"}]
["line_result",{"type":"inspect","line_number":2,"inspected":"8"}]
["line_result",{"type":"inspect","line_number":3,"inspected":"5"}]
["event_stream_closed",{"side":"producer"}]
["stderr_closed",{"side":"producer"}]
["stdout_closed",{"side":"producer"}]
["exitstatus",{"value":0}]
["finished",{}]