Hacker News new | ask | show | jobs
by amthewiz 2922 days ago
Ruby's optional parenthesis for function calls. Makes beautiful DSLs like RSpec -

  describe UsersController do
    before do
      allow(controller).to receive(:current_user).and_return(nil)
    end

    describe "GET #new" do
      subject { get :new }

      it "returns success" do
        expect(subject).to be_success
      end
    end
  end
1 comments

But I love the brace free dsl. It's pretty. How van you tell how many tokens it takes? Describe or subject take? It's a bit hard to parse, but I don't know Ruby.

Coming from Python the end end end hurts though. Why not just use braces then?