Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/generators/derail/app/bootstrap.rb,
lib/derail/core_ext/string.rb
Overview
TODO: Sprockets require to include library files or some fancy shiznit.
Instance Method Summary collapse
Instance Method Details
#dedent ⇒ Object
2 3 4 5 |
# File 'lib/derail/core_ext/string.rb', line 2 def dedent indent = lines.reject(&:empty?).map { |line| line.index(/\S/) }.compact.min gsub /^ {1,#{indent.to_i}}/, '' end |
#redent(prefix) ⇒ Object
7 8 9 10 |
# File 'lib/derail/core_ext/string.rb', line 7 def redent prefix prefix = " " * prefix if prefix.is_a? Numeric dedent.gsub! /^(?=[ \t]*\S+)/, prefix end |