Sha256: 56ab39f2fcc1bfcef5684fe395401b2cf34a41cf5dec40f174045098fd6e0875

Contents?: true

Size: 738 Bytes

Versions: 15

Compression:

Stored size: 738 Bytes

Contents

# module ::Kernel
#   def recursive_require(str)
#     Dir["#{$:.first}/#{str}"].each do |file|
#       require file
#     end
#   end
# end

class ::String
  def parentheses
    "(#{self})"
  end

  def braces
    "{#{self}}"
  end

  def rm(str_or_rgx)
    gsub(str_or_rgx, '')
  end

  def rm!(str_or_rgx)
    gsub!(str_or_rgx, '')
    self
  end

  def rms!(*str_or_rgxs)
    str_or_rgxs.each do |str_or_rgx|
      rm!(str_or_rgx)
    end
    self
  end

  def split_by_sp
    split(/ +/)
  end

  # FIX:
  def equalize!
    rms!(/\A +/, / +\z/)
    if self =~ /\A\(/ && self =~ /\)\z/
      rms!(/\A\(/, /\)\z/)
      rms!(/\A +/, / +\z/)
    else
      self
    end
  end
end

class ::Array
  def join_by_sp
    join(' ')
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
hilbert-0.0.2700420 lib/hilbert/utils/ruby_ext.rb
hilbert-0.0.2700410 lib/hilbert/utils/ruby_ext.rb
hilbert-0.0.2700400 lib/hilbert/utils/ruby_ext.rb
hilbert-0.0.2700320 lib/hilbert/utils/ruby_ext.rb
hilbert-0.0.2700300 lib/hilbert/utils/ruby_ext.rb
hilbert-0.0.2700210 lib/hilbert/utils/ruby_ext.rb
hilbert-0.0.2700110 lib/hilbert/utils/ruby_ext.rb
hilbert-0.0.2700100 lib/hilbert/utils/ruby_ext.rb
hilbert-0.0.2700001 lib/hilbert/utils/ruby_ext.rb
hilbert-0.0.2700000 lib/qlang/utils/ruby_ext.rb
qlang-0.0.27182124 lib/qlang/utils/ruby_ext.rb
qlang-0.0.27182123 lib/qlang/utils/ruby_ext.rb
qlang-0.0.27182122 lib/qlang/utils/ruby_ext.rb
qlang-0.0.27182121 lib/qlang/utils/ruby_ext.rb
qlang-0.0.27182120 lib/qlang/utils/ruby_ext.rb