Class: String
Instance Method Summary collapse
- #double_quote ⇒ Object
- #needs_quoting?(check = /\s/) ⇒ Boolean
- #quote(char) ⇒ Object
- #quote_escape(char) ⇒ Object
- #single_quote ⇒ Object
Instance Method Details
#double_quote ⇒ Object
20 21 22 |
# File 'lib/deployable/patch/string/quoting.rb', line 20 def double_quote quote '"' end |
#needs_quoting?(check = /\s/) ⇒ Boolean
24 25 26 |
# File 'lib/deployable/patch/string/quoting.rb', line 24 def needs_quoting? check = /\s/ !!match(check) end |
#quote(char) ⇒ Object
3 4 5 6 7 |
# File 'lib/deployable/patch/string/quoting.rb', line 3 def quote char # improve this to escape chars, if they aren't already escaped raise if match char "#{char}#{self}#{char}" end |
#quote_escape(char) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/deployable/patch/string/quoting.rb', line 9 def quote_escape char #if m = match char # m. #end "#{char}#{self}#{char}" end |
#single_quote ⇒ Object
16 17 18 |
# File 'lib/deployable/patch/string/quoting.rb', line 16 def single_quote quote "'" end |