Skip to content

Commit

Permalink
Merge pull request #3 from railsaholic/avoid_indent_method_redefined_…
Browse files Browse the repository at this point in the history
…warning

Avoid, method redefined warning for method 'indent'
  • Loading branch information
cjheath committed Apr 3, 2013
2 parents 0ac1e57 + 2650a0e commit 714df97
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/treetop/ruby_extensions/string.rb
Expand Up @@ -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

Expand Down

0 comments on commit 714df97

Please sign in to comment.