Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/string.rb
Overview
Some useful additions to the String class
Instance Method Summary collapse
Instance Method Details
#ansi_attributes(*args) ⇒ Object
14 15 16 |
# File 'lib/string.rb', line 14 def ansi_attributes(*args) "\e[#{args.join(';')}m#{self}\e[0m" end |
#fake_erb ⇒ Object
18 19 20 |
# File 'lib/string.rb', line 18 def fake_erb gsub(/(<%=\s+([^%]+)\s+%>)/) { |e| eval "_ = #{e.split[1]}" } end |