Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/emenu/string.rb
Instance Method Summary collapse
Instance Method Details
#indent ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/emenu/string.rb', line 3 def indent tokens = self.split ("\n") result = '' if tokens.size > 0 prespace_index = tokens[0].index(/\S/) tokens.each do |token| result << token[prespace_index,(token.length - prespace_index)] << "\n" end end return result end |