Sha256: d92a4840aba183de5e6d4975241c4b767fd45a3c66cc3f33bc3c1b63c8d4ec46

Contents?: true

Size: 506 Bytes

Versions: 2

Compression:

Stored size: 506 Bytes

Contents

class String
  
  def remove_whitespace
    self.gsub(" ","")
  end
  
  def is_i?
    !!(self =~ /^[-+]?[0-9]([0-9]*)?$/)
  end
  
  def to_utf16le
    Iconv.conv('utf-16le', 'UTF-8', self)
  end
  
  def to_active_record_condition
    "%#{self.trim.gsub(/[[:space:]]+/, '%')}%"
  end  
 
  def blank?
	  self !~ /\S/
    rescue ArgumentError => e
      if e.message =~ /^(invalid\ byte\ sequence|incompatible\ character\ encodings)/
	      empty?
      else
	      raise e
      end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itrigga-core_ext-0.2.2 lib/itrigga/core_ext/string.rb
itrigga-core_ext-0.2.1 lib/itrigga/core_ext/string.rb