lib/facet/symbol/pad.rb in facets-0.7.2 vs lib/facet/symbol/pad.rb in facets-0.9.0
- old
+ new
@@ -1,20 +2 @@
-class Symbol
- # Easily manipulate undercores on symbols.
- #
- # require 'facet/symbol/pad'
- #
- # :a.pad(2) #=> :__a__
- # :__a__.pad(-1) #=> :_a_
- #
- def pad(i=1)
- return self if i == 0
- s = self.to_s
- if i > 0
- return ( ('_'*i) + self.to_s + ('_'*i) ).to_sym
- else
- i *= -1
- return s[i..-i-1].to_sym if s[0..i-1] == ('_'*i) and s[-i..-1] == ('_'*i)
- return self
- end
- end
-end
+require 'nano/symbol/pad.rb'
\ No newline at end of file