michaeledgar / seamless

Write ruby without all those 'end's.
MIT License
72 stars 2 forks source link

seamless

Python allows you to signal the end of a code block with indentation. Ruby suffers from an extremely verbose and tedious block terminator, "end". Much like Lisps end up with dozens of close-parens, Ruby files that use modules and classes heavily end up with a plethora of "ends" that just aren't necessary.

Write a Ruby file, but skip all the "ends". Line up your code blocks like in Python. Then just call it 'your_file.rbe', require 'seamless', and require 'your_file'. Seamless does the rest.

Should this ever see widespread use? I don't know. But it's pretty fun!

Example

module Hello
  module World
    class Runner
      def initialize(user)
        @user = user
      def run
        puts "Hello, #{@user}"

Much cleaner! Sure, a bit contrived, but no more ends!

Note on Patches/Pull Requests

Copyright

Copyright (c) 2010 Michael Edgar. See LICENSE for details.