class Prism::Debug::Encoding
A wrapping around prism’s internal encoding data structures. This is used for reflection and debugging purposes.
Attributes
The name of the encoding, that can be passed to Encoding.find.
Public Class Methods
Initialize a new encoding with the given name and whether or not it is a multibyte encoding.
# File prism/debug.rb, line 214 def initialize(name, multibyte) @name = name @multibyte = multibyte end
Public Instance Methods
Returns true if the first character in the source string is a valid alphanumeric character for the encoding.
# File prism/debug.rb, line 232 def alnum?(source) Encoding._alnum?(name, source) end
Returns true if the first character in the source string is a valid alphabetic character for the encoding.
# File prism/debug.rb, line 238 def alpha?(source) Encoding._alpha?(name, source) end
Whether or not the encoding is a multibyte encoding.
# File prism/debug.rb, line 220 def multibyte? @multibyte end
Returns true if the first character in the source string is a valid uppercase character for the encoding.
# File prism/debug.rb, line 244 def upper?(source) Encoding._upper?(name, source) end
Returns the number of bytes of the first character in the source string, if it is valid for the encoding. Otherwise, returns 0.
# File prism/debug.rb, line 226 def width(source) Encoding._width(name, source) end