Module: DeepCover::Tools::IndentString
- Defined in:
- lib/deep_cover/tools/indent_string.rb
Constant Summary collapse
- IMPLEMENTATION =
In-place implementation copied from active-support.
->(amount, indent_string = nil, indent_empty_lines = false) do indent_string = indent_string || self[/^[ \t]/] || ' ' re = indent_empty_lines ? /^/ : /^(?!$)/ gsub!(re, indent_string * amount) end
Instance Method Summary collapse
-
#indent_string(string, *args) ⇒ Object
Same as #indent from active-support github.com/rails/rails/blob/10e1f1f9a129f2f197a44009a99b73b8ff9dbc0d/activesupport/lib/active_support/core_ext/string/indent.rb#L42.
-
#indent_string!(string, *args) ⇒ Object
Same as #indent! from active-support github.com/rails/rails/blob/10e1f1f9a129f2f197a44009a99b73b8ff9dbc0d/activesupport/lib/active_support/core_ext/string/indent.rb#L7.
Instance Method Details
#indent_string(string, *args) ⇒ Object
Same as #indent from active-support github.com/rails/rails/blob/10e1f1f9a129f2f197a44009a99b73b8ff9dbc0d/activesupport/lib/active_support/core_ext/string/indent.rb#L42
20 21 22 23 24 |
# File 'lib/deep_cover/tools/indent_string.rb', line 20 def indent_string(string, *args) string = string.dup indent_string!(string, *args) string end |
#indent_string!(string, *args) ⇒ Object
Same as #indent! from active-support github.com/rails/rails/blob/10e1f1f9a129f2f197a44009a99b73b8ff9dbc0d/activesupport/lib/active_support/core_ext/string/indent.rb#L7
14 15 16 |
# File 'lib/deep_cover/tools/indent_string.rb', line 14 def indent_string!(string, *args) string.instance_exec(*args, &IMPLEMENTATION) end |