Example
puts "\033[31mRed Text"
Up/Down Arrow and ctrl-p/ctrl-n: Navigate through history ctrl-a: Beginning of line ctrl-e: End of line ctrl-b: Back 1 character ctrl-f: Forward 1 character ctrl-d: Delete 1 character ctrl-k: Kill to the end of the line alt-b: Back 1 word alt-f: Forward 1 word alt-d: Delete 1 word
opal> S<tab> STDERR STDIN STDOUT ScriptError Set SignalException StandardError StopIteration String StringIO StringScanner Struct Symbol SyntaxError SystemCallError SystemExit
opal> ST<tab> STDERR STDIN STDOUT
opal> STDI<tab>
opal> STDIN
Welcome to Opal 0.7.1 type help for assistance opal> class Foo ... def bar ... :bar ... end ... end => "bar" opal>
In irb the last value returned is stored in _ variable:
2.2.1 :001 > 2 * 3 => 6 2.2.1 :002 > puts _ 6 => nil 2.2.1 :003 >
opal> 2 * 3 => 6 opal> puts $_ 6 => nil opal>
Help in irb allows you to lookup documentation for methods via ri and rdoc docs.
2.0.0-p247 :001 > help Enter the method name you want to look up. You can use tab to autocomplete. Enter a blank line to exit. >>
opal> help help: This text $_ last value returned is stored in this global history: Shows history irb_link_for history_num: Create a link for the code in the history ctrl-c: Abort prompt ctrl-m: Pop up multi-line editor ctrl-Enter: Submit code in multi-line editor ctrl-l: Creates a link with the code you have on the current line/lines EDITOR FUNCTIONALITY Up/Down Arrow and ctrl-p/ctrl-n: Navigate through history ctrl-a: Beginning of line ctrl-e: End of line ctrl-b: Back 1 character ctrl-f: Forward 1 character ctrl-d: Delete 1 character ctrl-k: Kill to the end of the line alt-b: Back 1 word alt-f: Forward 1 word alt-d: Delete 1 word => nil
There are number of things that opal-irb does that irb does not:
ctl-l (l for link),ctl-l to give history for that linehistory at the prompt to get a listing of your history.
opal> history
1: class Foo
def bar
:bar
end
end
2: f = Foo.new
3: f.bar
4: history
=> nil
opal>
ctrl-lirb_link_for command with the history numberjsbin, jsfiddle, etc.irb_link_for <history_num>
ctrl-c and start overctrl-m (m for the multi-line editor)ctl-m.ctrl-Enter short cut.require_remote allows you require a remote ruby file.require_remote <url_to_ruby_file>"
As an example, I'll require the raw form of this gist, which prints out "require_remote is cool" 10 times.
require_js of the raphael.js libTimeout and creates an animation and bind reanimation
code to the reanimate buttonSame raphael example, but without the delay
say command in OSX a lotjq-console, for improved console support.jq-console based opal-irbjq-console port to remove the jquery dependency in opal-irbembedded iframe does not render right in safari, use chrome
Thanks!