Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/rspec_api_blueprint/string_extensions.rb
Instance Method Summary collapse
Instance Method Details
#indent(count, char = ' ') ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/rspec_api_blueprint/string_extensions.rb', line 3 def indent(count, char = ' ') gsub(/([^\n]*)(\n|$)/) do |match| last_iteration = ($1 == "" && $2 == "") line = "" line << (char * count) unless last_iteration line << $1 line << $2 line end end |