Created
March 5, 2009 06:03
-
-
Save kematzy/74225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra/base' | |
module Sinatra | |
module AttrAccessorBug | |
# NB!! Using attr_accessor causes this error: | |
# | |
# SyntaxError: compile error (__DELEGATE__):2: syntax error, unexpected ',', expecting '=' ::Sinatra::Application.attr_accessor_bug_last=(*args, &b) ^ | |
# | |
attr_accessor :attr_accessor_bug_first, :attr_accessor_bug_last | |
# Whereas attr_reader works fine | |
# attr_reader :attr_accessor_bug_first, :attr_accessor_bug_last | |
def self.registered(app) | |
# app.helpers AttrAccessorBug::Helpers | |
end | |
end | |
register(Sinatra::AttrAccessorBug) | |
end | |
# ====================== | |
# require 'sinatra/base' | |
class Hello < Sinatra::Base | |
register Sinatra::AttrAccessorBug | |
get '/' do | |
"Hello World" | |
end | |
end | |
Hello.run! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment