Class: Mantra::MergeTool::Spiff
- Inherits:
-
Mantra::MergeTool
- Object
- Mantra::MergeTool
- Mantra::MergeTool::Spiff
- Defined in:
- lib/mantra/merge_tool/spiff.rb
Instance Method Summary collapse
Methods included from Helpers::ObjectWithType
Instance Method Details
#is_template?(string) ⇒ Boolean
17 18 19 |
# File 'lib/mantra/merge_tool/spiff.rb', line 17 def is_template?(string) !!string.match(/^\(\(.*\)\)$/) end |
#templatize(string, scope, start, finish) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/mantra/merge_tool/spiff.rb', line 6 def templatize(string, scope, start, finish) first_part = string[0..start-1] value = string[start..finish] last_part = string[finish..-1] first_part = first_part[3..-1] if first_part.end_with?("(( ") last_part = last_part[0..-4] if last_part.end_with?(" ))") ["((", "\"#{first_part}\"", scope, "\"#{last_part}\"", "))"].select do |s| s != "\"\"" end.join(" ") end |