Sha256: 74406710e8a658cca9e448ddce5eec66a917427cbd795b57b30e462b9dcecbb3

Contents?: true

Size: 431 Bytes

Versions: 5

Compression:

Stored size: 431 Bytes

Contents

class String

  def with_superscript_characters
    self.gsub(/\^2\b/,"²").gsub(/\^3\b/,"³")
  end

  def without_superscript_characters
    self.gsub(/¹\b/,"").gsub(/²\b/,"^2").gsub(/³\b/,"^3")
  end
  
  def remove_underscores
    self.gsub("_"," ")
  end

  def words
    split(/\s+/)
  end

  def word_count
    words.size
  end

  def to_quantity
    Quantify::Quantity.parse(self)
  end
  alias :to_q :to_quantity

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
quantify-2.0.0 lib/quantify/core_extensions/string.rb
quantify-1.2.2 lib/quantify/core_extensions/string.rb
quantify-1.2.1 lib/quantify/core_extensions/string.rb
quantify-1.2.0 lib/quantify/core_extensions/string.rb
quantify-1.1.0 lib/quantify/core_extensions/string.rb