Module: SharedInfrastructure::OutputHelpers
- Defined in:
- lib/shared_infrastructure/output.rb
Instance Method Summary collapse
-
#indent(s, amount = 2, indent_string = nil, indent_empty_lines = false) ⇒ Object
first character of ‘s`.
Instance Method Details
#indent(s, amount = 2, indent_string = nil, indent_empty_lines = false) ⇒ Object
first character of ‘s`.
10 11 12 13 14 |
# File 'lib/shared_infrastructure/output.rb', line 10 def indent(s, amount = 2, indent_string = nil, indent_empty_lines = false) indent_string = indent_string || s[/^[ \t]/] || " " re = indent_empty_lines ? /^/ : /^(?!$)/ s.gsub(re, indent_string * amount) end |