문제

When I'm using the rails console I like having a clear! command along side the reload! command, so every time I launch the rails console I write

def clear!
   system('clear')
end

When I repeat behavior in my bash shell I add it to my ~/.bashrc file. Is there a similar way for me to do this for my rails console?

도움이 되었습니까?

해결책

Create a file in your home directory named ~/.irbrc. Inside, define any functions or settings you want to be applied to your irb.

Here's an example that explains what I mean.

다른 팁

You can do this with Pry if you use that instead of irb. You can configure custom commands in a ~/.pryrc

Pry.config.commands.command "clear!", "Clears the display" do |*args|
  system("clear")
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top