Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Avoid, method redefined warning for method 'indent' #3

Merged
merged 1 commit into from

3 participants

@hindenbug

No description provided.

@cjheath cjheath merged commit 714df97 into from
@skoba

Because ActiveSupport 4.0.0.rc1defines indent method in String class, indent in tabto method calls ActiveSupport::String.indent and cause error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 3, 2013
  1. @hindenbug
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/treetop/ruby_extensions/string.rb
View
12 lib/treetop/ruby_extensions/string.rb
@@ -28,11 +28,13 @@ def tabto(n)
end
end
- def indent(n)
- if n >= 0
- gsub(/^/, ' ' * n)
- else
- gsub(/^ {0,#{-n}}/, "")
+ unless method_defined?(:indent)
+ def indent(n)
+ if n >= 0
+ gsub(/^/, ' ' * n)
+ else
+ gsub(/^ {0,#{-n}}/, "")
+ end
end
end
Something went wrong with that request. Please try again.