---
title: "ทำให้วางโค้ด Ruby หลายบรรทัดใน Pry ได้เมื่อใช้ leading dot notation"
description: "ตอนนี้เราใช้ leading dot notation กันบ่อยมาก เช่น"
canonical: https://oozou.com/til/allow-pasting-multiline-ruby-blocks-in-pry-when-using-leading-dot-notation-116
locale: th
date: 2021-04-30
topic: ruby
---

# ทำให้วางโค้ด Ruby หลายบรรทัดใน Pry ได้เมื่อใช้ leading dot notation

> ตอนนี้เราใช้ leading dot notation กันบ่อยมาก เช่น

Published: 2021-04-30 · Topic: [ruby](https://oozou.com/th/til-topics/ruby) ([markdown](https://oozou.com/th/til-topics/ruby.md))

ตอนนี้เราใช้ leading dot notation กันบ่อยมาก เช่น

```ruby
Foo
  .bar
  .baz
```

ถ้าคุณคัดลอกโค้ดนี้ไปวางใน Pry REPL จะเกิด error เพราะมันไม่รู้วิธี parse โค้ดแบบนี้ ตอนแรกคิดว่าเป็นเพราะ Pry parse ต่างจาก IRB แต่จริง ๆ แล้วเป็นเพราะ Pry มีฟีเจอร์เรียก system method โดยใส่จุดนำหน้า ถ้าอยากคัดลอกวางโค้ดแบบนี้ได้ ก็แค่ลบ command ของ Pry ออก

```ruby
Pry.commands.delete /\.(.*)/
```

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/th/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
