https://github.com/zw963/pry-disasm
Pry plugin that displays YARV bytecode for a method or expression.
https://github.com/zw963/pry-disasm
Last synced: 10 months ago
JSON representation
Pry plugin that displays YARV bytecode for a method or expression.
- Host: GitHub
- URL: https://github.com/zw963/pry-disasm
- Owner: zw963
- License: mit
- Created: 2019-04-28T13:38:11.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-02T02:10:44.000Z (about 7 years ago)
- Last Synced: 2025-02-11T10:05:19.474Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PryDisasm [](http://badge.fury.io/rb/pry-disasm)
A bunch of code was taken from [pry-internal](https://github.com/cout/pry-internal/tree/master/pry-disasm).
Pry plugin that take a `Method object` or `ruby code` string, and returns a String with the human readable instructions(YARV bytecode) for it.
## Getting Started
Install via Rubygems
$ gem install pry-disasm
then add `require 'pry-disasm'` in your ruby code.
OR ...
Add to your Gemfile
gem 'pry-disasm'
## Usage
See Instruction for a method
```rb
(pry):main(0)> def say_hello; puts 'hello'; end
=> :say_hello
(pry):main(0)> disasm method(:say_hello)
== disasm: # (catch: FALSE)
0000 putself ( 1)[LiCa]
0001 putstring "hello"
0003 opt_send_without_block ,
0006 leave [Re]
```
see Instruction of a expression
```rb
(pry):main(0)> disasm '1 + 1'
== disasm: #@:1 (1,0)-(1,5)> (catch: FALSE)
0000 putobject_INT2FIX_1_ ( 1)[Li]
0001 putobject_INT2FIX_1_
0002 opt_plus ,
0005 leave
```
## Support
* MRI 1.9.3+
## Contributing
* [Bug reports](https://github.com/zw963/pry-disasm/issues)
* [Source](https://github.com/zw963/pry-disasm)
## license
Released under the MIT license, See [LICENSE](https://github.com/zw963/pry-disasm/blob/master/LICENSE) for details.