Class: String
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#substitute(binding) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/RubyExt/string.rb', line 14 def substitute binding binding.should! :be_a, Binding return gsub(/\#\{.+?\}/) do |term| identifier = term.slice(2 .. term.size-2) binding.eval identifier end end |
#to_iv ⇒ Object
10 11 12 |
# File 'lib/RubyExt/string.rb', line 10 def to_iv "@#{self}" end |
#to_reader ⇒ Object
2 3 4 |
# File 'lib/RubyExt/string.rb', line 2 def to_reader self.to_sym end |
#to_writer ⇒ Object
6 7 8 |
# File 'lib/RubyExt/string.rb', line 6 def to_writer "#{self}=".to_sym end |