Sha256: c2e412ebf2542a234d642aeb0e5aa952ee91908acce2cef25e99ef2f110b807e
Contents?: true
Size: 955 Bytes
Versions: 4
Compression:
Stored size: 955 Bytes
Contents
require 'rubygems' require 'pry' # Brute force or otherwise it won't work for all platforms. begin $:.unshift File.expand_path("../../lib", __FILE__) require 'pry-theme' rescue end require 'bacon' puts "Ruby version: #{RUBY_VERSION}; Pry Theme version: #{PryTheme::VERSION}" class InputTester def initialize(*actions) @orig_actions = actions.dup @actions = actions end def readline(*) @actions.shift end def rewind @actions = @orig_actions.dup end end def mock_pry(*args) args.flatten! binding = args.first.is_a?(Binding) ? args.shift : binding() input = InputTester.new(*args) output = StringIO.new redirect_pry_io(input, output) do binding.pry end output.string end def redirect_pry_io(new_in, new_out = StringIO.new) old_in = Pry.input old_out = Pry.output Pry.input = new_in Pry.output = new_out begin yield ensure Pry.input = old_in Pry.output = old_out end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pry-theme-0.1.3 | test/helper.rb |
pry-theme-0.1.2 | test/helper.rb |
pry-theme-0.1.1 | test/helper.rb |
pry-theme-0.1.0 | test/helper.rb |