LoginSignup
2
4

More than 1 year has passed since last update.

Ruby | pry でファイルに書いたクラスを読み込んでテストする

Last updated at Posted at 2016-11-04

手順

適当に ruby ファイルを作る

/tmp/example.rb
class Example
  def self.yes
    puts 'YES!'
  end
end

pry を立ち上げて先程の require する

$ pry
 [1] pry(main)> require '/tmp/example'
=> true

メソッドを実行する

[2] pry(main)> Example.yes
YES!

環境

  • Pry version 0.10.4 on Ruby 2.3.1

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4