Sha256: e56909aa1f9f80014a53ef6ce2a0cf75de1cc7fb735f5e0c07d4f69efa538f51
Contents?: true
Size: 740 Bytes
Versions: 3
Compression:
Stored size: 740 Bytes
Contents
# Allows [Ripl](https://github.com/cldwalker/ripl) to execute code or print a message after every result. # # @example 1) Printing a blank line after each result # require_relative 'ripl-after-result' # Ripl::Shell.include Ripl::AfterResult # Ripl.config.merge! after_result:"\n" # # @example 2) Executing arbitrary code with the result # results = [] # require_relative 'ripl-after-result' # Ripl::Shell.include Ripl::AfterResult # Ripl.config.merge! after_result:proc{ |result| results << result } module Ripl::AfterResult # @private no need to document the method def print_result(result) super if after=config[:after_result] if after.respond_to?(:call) after.call(result) else puts after end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
RUIC-0.5.0 | lib/ruic/ripl-after-result.rb |
RUIC-0.4.4 | lib/ruic/ripl-after-result.rb |
RUIC-0.4.3 | lib/ruic/ripl-after-result.rb |