Class String
In: lib/ankusa/extensions.rb
Parent: Object

Methods

numeric?   to_ascii  

Public Instance methods

[Source]

# File lib/ankusa/extensions.rb, line 4
  def numeric?
    true if Float(self) rescue false
  end

[Source]

# File lib/ankusa/extensions.rb, line 8
  def to_ascii
    # from http://www.jroller.com/obie/tags/unicode
    converter = Iconv.new('ASCII//IGNORE//TRANSLIT', 'UTF-8') 
    converter.iconv(self).unpack('U*').select { |cp| cp < 127 }.pack('U*') rescue ""
  end

[Validate]