Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/asciify.rb

Instance Method Summary collapse

Instance Method Details

#ascii?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/asciify.rb', line 100

def ascii?
  self.to_enum(:each_byte).all? { |b| b < 128 }
end

#asciify(*args) ⇒ Object

removes all characters which are not part of ascii and replaces them with replacement

replacement is supposed to be the same encoding as source



96
97
98
# File 'lib/asciify.rb', line 96

def asciify(*args)
  Asciify.new(*args).convert(self)
end