Sha256: aa7a1850e1b4aab689500d2399b9c3313ae64433235d8fa9dbec5b70ba69abdd

Contents?: true

Size: 310 Bytes

Versions: 19

Compression:

Stored size: 310 Bytes

Contents

module StringExtensions

  def remove_internal_spaces
    gsub(/[\n|\r|\s]+/, '')
  end

  def rgb_to_integer
    if self.length == 7 # '#FF00FF'
      Integer(self.gsub('#', '0x'))
    else
      raise "#{self} doesn't seem to be a proper RGB code."
    end
  end
end

String.send :include, StringExtensions

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
semin-egor-0.9.0 lib/string_extensions.rb
semin-egor-0.9.1 lib/string_extensions.rb
semin-egor-0.9.2 lib/string_extensions.rb
semin-egor-0.9.3 lib/string_extensions.rb
semin-ulla-0.9.3 lib/string_extensions.rb
semin-ulla-0.9.4 lib/string_extensions.rb
semin-ulla-0.9.5 lib/string_extensions.rb
semin-ulla-0.9.6 lib/string_extensions.rb
semin-ulla-0.9.7 lib/string_extensions.rb
semin-ulla-0.9.8 lib/string_extensions.rb
semin-ulla-0.9.9 lib/string_extensions.rb
ulla-0.9.9 lib/string_extensions.rb
ulla-0.9.8 lib/string_extensions.rb
egor-0.9.0 lib/string_extensions.rb
ulla-0.9.4 lib/string_extensions.rb
ulla-0.9.3 lib/string_extensions.rb
ulla-0.9.6 lib/string_extensions.rb
ulla-0.9.5 lib/string_extensions.rb
ulla-0.9.7 lib/string_extensions.rb