Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/hilbert/utils/ruby_ext.rb
Overview
module ::Kernel
def recursive_require(str)
Dir["#{$:.first}/#{str}"].each do |file|
require file
end
end
end
Instance Method Summary collapse
- #braces ⇒ Object
-
#equalize! ⇒ Object
FIX:.
- #parentheses ⇒ Object
- #rm(str_or_rgx) ⇒ Object
- #rm!(str_or_rgx) ⇒ Object
- #rms!(*str_or_rgxs) ⇒ Object
- #split_by_sp ⇒ Object
Instance Method Details
#braces ⇒ Object
14 15 16 |
# File 'lib/hilbert/utils/ruby_ext.rb', line 14 def braces "{#{self}}" end |
#equalize! ⇒ Object
FIX:
39 40 41 42 43 44 45 46 47 |
# File 'lib/hilbert/utils/ruby_ext.rb', line 39 def equalize! rms!(/\A +/, / +\z/) if self =~ /\A\(/ && self =~ /\)\z/ rms!(/\A\(/, /\)\z/) rms!(/\A +/, / +\z/) else self end end |
#parentheses ⇒ Object
10 11 12 |
# File 'lib/hilbert/utils/ruby_ext.rb', line 10 def parentheses "(#{self})" end |
#rm(str_or_rgx) ⇒ Object
18 19 20 |
# File 'lib/hilbert/utils/ruby_ext.rb', line 18 def rm(str_or_rgx) gsub(str_or_rgx, '') end |
#rm!(str_or_rgx) ⇒ Object
22 23 24 25 |
# File 'lib/hilbert/utils/ruby_ext.rb', line 22 def rm!(str_or_rgx) gsub!(str_or_rgx, '') self end |
#rms!(*str_or_rgxs) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/hilbert/utils/ruby_ext.rb', line 27 def rms!(*str_or_rgxs) str_or_rgxs.each do |str_or_rgx| rm!(str_or_rgx) end self end |
#split_by_sp ⇒ Object
34 35 36 |
# File 'lib/hilbert/utils/ruby_ext.rb', line 34 def split_by_sp split(/ +/) end |