pry

Get pry to display characters like [äöüßÄÖÜß] (utf-8 encoding)? (Possibly Windows-specific issue?)

三世轮回 提交于 2019-12-30 06:58:06
问题 [ All the scripts I'm working with with these German characters are in UTF-8 themselves, have #encoding: utf-8 at the top (and Encoding.external_default = 'utf-8' , not that that's really relevant I think because German chars in strings that are defined within the script don't get displayed right.) ] All these things display fine at the windows command prompt and using irb etc. I can't even enter these characters at the pry prompt, though. Attempting to paste in puts "äöüÄÖÜß" gets puts " .

`Apartment::Tenant.switch!` during `bin/rails console` using `pry`

走远了吗. 提交于 2019-12-25 03:26:16
问题 when console is launched while at console prompt How it should work? See the output here. Simple, quick methods. T.me (current tenant), T.names (tenants in the DB), ... Launch, ask for tenant selection, set $ bin/rails c Running via Spring preloader in process 11233 Loading development environment (Rails 5.1.5) (1.9ms) SELECT "public"."tenants"."subdomain" FROM "public"."tenants" WHERE "public"."tenants"."deleted_at" IS NULL ORDER BY "public"."tenants"."created_at" DESC Available tenants: {0=

Building pry plugin(gem) with bundler

瘦欲@ 提交于 2019-12-24 13:16:38
问题 As explained here pry's plugin require pry- prefix. I have tried building using bundler: bundle gem pry-name but it messed up directory hierarchies(creating 2 instead of 1 directory): create pry-name/pry-name.gemspec create pry-name/lib/pry/name.rb create pry-name/lib/pry/name/version.rb In the gemspec it is using wrong directory structure: require 'pry/name/version' and in the same file it run this git command: spec.files = `git ls-files`.split($/) which gives, same as above, wrong structure

How can I set my Pry prompt to be the current timestamp?

谁都会走 提交于 2019-12-24 11:37:00
问题 When I put the following line into ~/.pryrc it doesn't work as expected: Pry.config.prompt_name = Time.now.to_s Every prompt is equal to the time that Pry was launched. How do I update the prompt with the current timestamp, each time the prompt is displayed (after each call)? 回答1: You need to use prompt not prompt_name Pry.config.prompt = Proc.new { |output, value| Time.now.to_s[0..-6] } 来源: https://stackoverflow.com/questions/22084481/how-can-i-set-my-pry-prompt-to-be-the-current-timestamp

Breakpoints with pry-byebug don't trigger in the console

给你一囗甜甜゛ 提交于 2019-12-24 00:44:32
问题 I'm trying to use pry and pry-byebug to step through the execution of some code in a Rails console. I started the console with pry -r ./config/environment I then set a breakpoint: break Foo#bar Then make a new Foo and call bar on it: Foo.new.bar I expected step into Foo#bar , but instead the method just executed normally. Is there some way to get this workflow to work? 回答1: I found the answer: the debugger is not re-entrant. So you need to do this: [1] pry(main)> binding.pry [1] pry(main)>

Is there a reliable tool for stepping through code while serving in foreman

◇◆丶佛笑我妖孽 提交于 2019-12-23 23:05:47
问题 I'm looking for some suggestions on a tool similar to using binding.pry. I'm serving a rails app locally with foreman and would like to accomplish the same ability to put "debuggers" in my code and when the process hits that, freeze and open a console environment in that section of the code. I've tried using pry with foreman to no avail and was curious if there are other known tools I'm not finding through google? Thanks for the suggestions. 回答1: Try pry-remote, it seems to be the answer of

How to use pry-byebug in an example script for a gem?

自作多情 提交于 2019-12-14 04:18:22
问题 I'm working on making my first gem, which is not a Rails app, is a tic-tac-toe library with some AI in it, so I can play a computer opponent that will never lose and force a win if possible. Right now I am trying to debug the attack strategy in the AI, but I can't seem to figure out how to get pry-byebug working in my test script, specfically, have the debugging commands like step , next , etc. work upon hitting a binding.pry . The gem, named smart-tac-toe, has the following directory

Pry is not a module

痴心易碎 提交于 2019-12-14 03:28:07
问题 Ok, as @tim-moore asked, I will post it in new question. Ok, so I wanted to make gem using bundle. Pry extension gem require that gem start with pry- as mentioned here. I used: bundle gem pry-name but it messed up my file structure create pry-name/pry-name.gemspec create pry-name/lib/pry/name.rb create pry-name/lib/pry/name/version.rb As you can see it created lib/pry directory. I know it's gem's style to created such structure but now I pry cannot load this gem automatically One solution

Use Pry in gems without modifying the Gemfile or using `require`

ⅰ亾dé卋堺 提交于 2019-12-13 12:00:20
问题 I am trying to debug a gem that's used by a Rails app. I cloned the Gem locally to go prying around (and also allows me to do nice things such as git bisect , etc.) # Gemfile gem "active_admin", path: "~/dev-forks/active_admin" However, I am often stuck with adding Pry to a Gemfile somewhere to be able to use it, or calling require "pry" live in the code even though I don't want it in there. For example, I will sometimes forget about it, fix the bug, and then commit to the project with Pry in

pry-nav work unexpectedly

谁说胖子不能爱 提交于 2019-12-12 09:30:13
问题 I put binding.pry in my script, But now when it's stopped at the breakpoint, is shows me that information. Which is out of my expectation, how to fix it ? Frame number: 0/11 From: /Users/me/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/pry-nav-0.2.4/lib/pry-nav/tracer.rb @ line 21 PryNav::Tracer#run: 12: def run(&block) 13: # For performance, disable any tracers while in the console. 14: # Unfortunately doesn't work in 1.9.2 because of 15: # http://redmine.ruby-lang.org/issues/3921. Works