Module: AmazingTap::ObjectExtension
- Included in:
- Object
- Defined in:
- lib/amazing_tap.rb
Instance Method Summary collapse
-
#tapp(label = nil, type: AmazingTap.show_type, backtrace: false) ⇒ self
(also: #tapap)
Prints the receiver via amazing_print with a labeled header, then returns it, so calls chain safely.
Instance Method Details
#tapp(label = nil, type: AmazingTap.show_type, backtrace: false) ⇒ self Also known as: tapap
Prints the receiver via amazing_print with a labeled header, then returns it, so calls chain safely. Without an explicit label, the label is inferred from the receiver expression at the call site; when inference fails the header shows only the class.
98 99 100 101 102 103 104 |
# File 'lib/amazing_tap.rb', line 98 def tapp(label = nil, type: AmazingTap.show_type, backtrace: false) raise ArgumentError, "label must be a Symbol" unless label.nil? || label.is_a?(Symbol) label ||= AmazingTap.infer_label(caller_locations(1, 1).first) AmazingTap.print_labeled(self, label, callers: caller, type: type, backtrace: backtrace) self end |