https://github.com/kevinstuffandthings/shellable
Open a REPL within the context of any Ruby object
https://github.com/kevinstuffandthings/shellable
repl ruby rubygems
Last synced: 9 months ago
JSON representation
Open a REPL within the context of any Ruby object
- Host: GitHub
- URL: https://github.com/kevinstuffandthings/shellable
- Owner: kevinstuffandthings
- License: mit
- Created: 2020-08-16T13:45:36.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-27T16:44:24.000Z (about 3 years ago)
- Last Synced: 2025-08-20T08:59:15.421Z (10 months ago)
- Topics: repl, ruby, rubygems
- Language: Ruby
- Homepage:
- Size: 14.6 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Shellable  [](https://badge.fury.io/rb/shellable)
Open a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) within the context of any Ruby object.
Originally written for the [TimeBoss](https://github.com/kevinstuffandthings/timeboss) gem.
## Installation
Add this line to your application's Gemfile:
```ruby
# update with the version of your choice
gem 'shellable'
```
And then execute:
```bash
$ bundle install
```
Or install it yourself as:
```bash
$ gem install shellable
```
## Usage
Imagine you're building a new Ruby library, and you'd like to provide users with a way to experiment with that new library from the inside.
When developing the `TimeBoss` gem, I wanted to create a [Rake task](https://github.com/kevinstuffandthings/timeboss#repl) to do just that.
```ruby
require 'timeboss/calendars'
calendar = TimeBoss::Calendars[:broadcast]
# => #
```
Once the desired target object for our REPL has been created, we can simply make it "shellable":
```ruby
require 'shellable'
Shellable.open(calendar)
```
To check out a real-life example, head over to the TimeBoss [`timeboss:calendars:*:repl`](https://github.com/kevinstuffandthings/timeboss/blob/1e7a27de0add7da4fe77b49af62b650a7771021b/lib/tasks/calendars.rake#L12-L16) task definition.
```
$ rake timeboss:calendars:broadcast:repl
2.4.1 :001 > this_week
=> #
2.4.1 :002 > parse('2020Q4..2021Q2')
=> #..#] start_date=2020-09-28, end_date=2021-06-27>
2.4.1 :003 >
```
# Problems?
Please submit an [issue](https://github.com/kevinstuffandthings/shellable/issues).
We'll figure out how to get you up and running with Shellable as smoothly as possible.