Contents

Inspect with source location

Kernel#ql works just like Kernel#pp from the built-in pp library, except that it writes to $stderr, and it prints the source location.

Scenario: Inspect an object

  • Given a file named "example.rb" with:
    ruby
    require "cute_print"
    ql "abc"
  • Then stderr should be
    example.rb:2: "abc"
    

Scenario: Inspect two objects

  • Given a file named "example.rb" with:
    ruby
    require "cute_print"
    ql "abc", 123
  • Then stderr should be
    example.rb:2: "abc"
    example.rb:2: 123
    

Scenario: Inspect with source

  • Given a file named "example.rb" with:
    ruby
    require "cute_print"
    ql {1 + 2}
  • Then stderr should be
    example.rb:2: (1 + 2) is 3
    

Scenario: Just print the location

  • Given a file named "example.rb" with:
    ruby
    require "cute_print"
    ql
  • Then stderr should be
    example.rb:2
    

Source: features/inspect/inspect_with_location.feature at commit e8ebd2a4, Cute Print (MIT license).