Class: String

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

Overview

This file extends the String class with methods to allow encoding and decoding of HTML/XML entities from/to their corresponding UTF-8 codepoints.

Instance Method Summary collapse

Instance Method Details

#decode_entitiesObject

Decode XML and HTML 4.01 entities in a string into their UTF-8 equivalents.



13
14
15
# File 'lib/htmlentities/string.rb', line 13

def decode_entities
  return HTMLEntities.decode_entities(self)
end

#encode_entities(*instructions) ⇒ Object

Encode codepoints in a string into their corresponding entities. See the documentation of HTMLEntities.encode_entities for a list of possible instructions.



22
23
24
# File 'lib/htmlentities/string.rb', line 22

def encode_entities(*instructions)
  return HTMLEntities.encode_entities(self, *instructions)
end