Project

behold

0.0
No release in over a year
Behold!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

 Project Readme

Behold

Warning

THIS IS UNSAFE, EXPERIMENTAL CODE.

This gem runs arbitrary code and can be capriciously destructive. Be warned!

Installation

gem install behold

Examples

require 'behold'

Behold.call 5, 25
#=> [[:abs2], [:**, 2], [:pow, 2], [:*, 5], [:+, 20], [:lcm, 25]]

Behold.call 'hi', 'hi!'
#=> [[:+, "!"], [:<<, "!"], [:concat, "!"], [:<<, 33], [:concat, 33], [:insert, 2, "!"]]

Behold.call [1, 2, 3], '1,2,3'
#=> [[:*, ","], [:join, ","]]

Behold.call Object, 'Object'
#=> [[:inspect], [:to_s], [:name], [:class_name], [:pretty_print_inspect]]

Behold.call 1, 2
#=> [[:next], [:succ], [:<<, 1], [:+, 1], [:lcm, 2], [:*, 2]]

Behold.call 'BBQ', ['B', 'B', 'Q']
#=> [[:grapheme_clusters], [:chars], [:split, ""], [:lines, "B"], [:rpartition, "B"], [:split, //]]

puts Behold.code 'BBQ', ['B', 'B', 'Q']
#>> "BBQ".grapheme_clusters
#>> "BBQ".chars
#>> "BBQ".split("")
#>> "BBQ".lines("B")
#>> "BBQ".rpartition("B")
#>> "BBQ".split(//)

Command Line Examples

behold 21 42
#>> 21.<<(1)
#>> 21.lcm(2)
#>> 21.*(2)
#>> 21.lcm(6)
#>> 21.>>(-1.0)
#>> 21.<<(1.0)

behold 42 "'42'"
#>> 42.inspect
#>> 42.to_s
#>> 42.inspect(10)
#>> 42.to_s(10)
#>> 42.inspect(10)
#>> 42.to_s(10)