Skip to content

Commit

Permalink
Remove String core extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Nov 21, 2012
1 parent 0a8591e commit 5a9144c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
10 changes: 0 additions & 10 deletions lib/twitter/core_ext/string.rb

This file was deleted.

8 changes: 4 additions & 4 deletions lib/twitter/factory.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'twitter/core_ext/string'

module Twitter
class Factory

Expand All @@ -10,8 +8,10 @@ class Factory
# @return [Twitter::Action::Favorite, Twitter::Action::Follow, Twitter::Action::ListMemberAdded, Twitter::Action::Mention, Twitter::Action::Reply, Twitter::Action::Retweet]
def self.fetch_or_new(method, klass, attrs={})
return unless attrs
if type = attrs.delete(method.to_sym)
klass.const_get(type.camelize.to_sym).fetch_or_new(attrs)
type = attrs.delete(method.to_sym)
if type
const_name = type.gsub(/\/(.?)/){"::#{$1.upcase}"}.gsub(/(?:^|_)(.)/){$1.upcase}
klass.const_get(const_name.to_sym).fetch_or_new(attrs)
else
raise ArgumentError, "argument must have :#{method} key"
end
Expand Down

0 comments on commit 5a9144c

Please sign in to comment.