Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/regexrx2md/string.rb
Overview
String helpers
Instance Method Summary collapse
Instance Method Details
#indent ⇒ Object
9 10 11 12 13 |
# File 'lib/regexrx2md/string.rb', line 9 def indent out = '' split("\n").each { |line| out += " #{line}\n" } out end |
#snippet_note ⇒ Object
19 20 21 |
# File 'lib/regexrx2md/string.rb', line 19 def snippet_note split("\n").map { |line| "> #{line}" }.join("\n") end |
#to_js ⇒ Object
15 16 17 |
# File 'lib/regexrx2md/string.rb', line 15 def to_js gsub(%r{(?mi)(?<!\\)/}, '\/') end |
#unpack ⇒ Object
5 6 7 |
# File 'lib/regexrx2md/string.rb', line 5 def unpack [self].pack('H*').gsub(/\r/, "\n") end |