-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
84 additions
and
95 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,38 @@ | ||
module AbstractController | ||
class Base | ||
|
||
attr_internal :response_body | ||
attr_internal :response_obj | ||
attr_internal :action_name | ||
|
||
def self.process(action) | ||
new.process(action) | ||
end | ||
|
||
def self.inherited(klass) | ||
end | ||
|
||
def initialize | ||
self.response_obj = {} | ||
end | ||
|
||
def process(action_name) | ||
unless respond_to_action?(action_name) | ||
raise ActionNotFound, "The action '#{action_name}' could not be found" | ||
end | ||
|
||
@_action_name = action_name | ||
process_action | ||
self.response_obj[:body] = self.response_body | ||
self | ||
end | ||
|
||
private | ||
|
||
def process_action | ||
respond_to?(action_name) ? send(action_name) : send(:action_missing, action_name) | ||
end | ||
|
||
def respond_to_action?(action_name) | ||
respond_to?(action_name) || respond_to?(:action_missing, true) | ||
end | ||
|
||
end | ||
end | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module AbstractController | ||
class ActionNotFound < StandardError ; end | ||
end | ||
end |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ module Logger | |
cattr_accessor :logger | ||
end | ||
end | ||
end | ||
end |
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
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
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
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
Oops, something went wrong.
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
greatest... commit... ever...
no really, I instinctively remove whitespace in libraries and then put it back again, because I should not be touching it. I like it!
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Josh, how did you do that?
Eclipse has a plugin called AnyEdit (http://andrei.gmxhome.de/anyedit/index.html) to automatically remove white space on save. Is there any similar TextMate plugin?
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ngocdaothanh This might be worth checking out: http://www.viget.com/extend/out-damned-tabs/
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the coolest thing I've ever saw!
You're my hero.
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice commit, indeed. Vim'll do this nicely with a swift ggVG=
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, revolutionary to Rails! applaud Love your work! :)
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best commit ever.
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
@ngocdaothanh You can strip trailing whitespace in the open file in TextMate with ⌥⌘W.
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That just made my night. Awesome job!
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hilarious.
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can someone backport it to 2.3?
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ngocdaothanh There is a Textmate bundle on GitHub http://github.com/vigetlabs/whitespace-tmbundle/tree/master
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this trigger a flood of contributed whitespace patches
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what mislav said + "a flood of sarcastic comments [as seen above]". ;) oh crap. and i guess this one. :(
a747ab5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I frequently use TextMate's Find In Project to do this: find
\s+$
and replace with nothing.Adding newlines at the end of a file is a bit more challenging - find
([^\n])\Z
, replace$1\n
.