Project

show_code

0.0
No commit activity in last 3 years
No release in over 3 years
show_code provides a quick way to show ruby method source codes in terminal.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 10.0

Runtime

~> 1.1.1
 Project Readme

Show Code

show_code provides an easy way to show your ruby method source codes in terminal.

show_code_example

NOTE: show_code current version require Ruby v1.9.0 or later.

Installation

# Installing as Ruby gem
$ gem install show_code

# Or in gemfile
$ gem show_code

Usage

You will be able use show_code in rails c or irb.

require "show_code" # just when use irb
ShowCode method_object
# or
ShowCode 'YourClassOrModule.your_method'

Examples

show code

ShowCode 'ShowCode::Code.new.greet'

#     def greet
#       puts 'Hello ShowCode!'
#     end
# => #<UnboundMethod: ShowCode::Code#greet>

# also you can use this way, it does the same thing
ShowCode ShowCode::Code.instance_method(:greet)

open resource file

Sometimes, we wanna open the resource file to edit, as default gedit will open the file.

ShowCode.open 'ShowCode::Code.new.greet'
# or ShowCode.open ShowCode::Code.instance_method(:greet)

TODO

  • Add more statistic analysis for output

License

Released under the MIT license. See LICENSE file for details.