C
Caleb Clausen
endless.rb is a pre-processor for ruby which allows you to use python-ish
indentation to delimit scopes, instead of having to type 'end' every time.
http://gist.github.com/117694
Basically, this makes the end keyword optional. If you leave off the
end, the preprocessor inserts an end for you at the next line indented
at or below the level of indentation of the line which started the scope.
Since endless.rb uses RubyLexer, it should be able to handle almost
all ruby syntax.
Examples:
begin
a
b
begin
a
rescue
b
else
d
ensure
c
class A
class B
class C
module D
foo
def a b
c
d
for i in 1..10 do
p i
pp i
To be endless in your own code, you must first require 'endless.rb',
then load files which are written endlessly using Endless.load, rather
than the usual plain vanilla load (or require). (Endless.require isn't
written yet, sorry.)
require 'endless'
Endless.load 'my-endless-code.rb'
Changes in this release:
Re-worked the way the def keyword is processed, to fix several bugs.
The new way is even a little bit less hacky.
Insert a space before implicit ends
Install:
endless.rb is available as a gist (jest?) on github only:
http://gist.github.com/117694
indentation to delimit scopes, instead of having to type 'end' every time.
http://gist.github.com/117694
Basically, this makes the end keyword optional. If you leave off the
end, the preprocessor inserts an end for you at the next line indented
at or below the level of indentation of the line which started the scope.
Since endless.rb uses RubyLexer, it should be able to handle almost
all ruby syntax.
Examples:
begin
a
b
begin
a
rescue
b
else
d
ensure
c
class A
class B
class C
module D
foo
def a b
c
d
for i in 1..10 do
p i
pp i
To be endless in your own code, you must first require 'endless.rb',
then load files which are written endlessly using Endless.load, rather
than the usual plain vanilla load (or require). (Endless.require isn't
written yet, sorry.)
require 'endless'
Endless.load 'my-endless-code.rb'
Changes in this release:
Re-worked the way the def keyword is processed, to fix several bugs.
The new way is even a little bit less hacky.
Insert a space before implicit ends
Install:
endless.rb is available as a gist (jest?) on github only:
http://gist.github.com/117694