Class: HTMLEntities::Encoder
- Inherits:
-
Object
- Object
- HTMLEntities::Encoder
- Defined in:
- lib/htmlentities/encoder.rb
Overview
:nodoc:
Constant Summary collapse
- INSTRUCTIONS =
[:basic, :named, :decimal, :hexadecimal]
Instance Method Summary collapse
- #encode(source) ⇒ Object
-
#initialize(flavor, instructions) ⇒ Encoder
constructor
A new instance of Encoder.
Constructor Details
#initialize(flavor, instructions) ⇒ Encoder
Returns a new instance of Encoder.
7 8 9 10 11 12 13 |
# File 'lib/htmlentities/encoder.rb', line 7 def initialize(flavor, instructions) @flavor = flavor instructions = [:basic] if instructions.empty? validate_instructions instructions build_basic_entity_encoder instructions build_extended_entity_encoder instructions end |
Instance Method Details
#encode(source) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/htmlentities/encoder.rb', line 15 def encode(source) minimize_encoding( replace_extended( replace_basic( prepare(source)))) end |