Class: Deplate::EntityDecode

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/deplate/mod/entities-decode.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#deplateObject

Returns the value of attribute deplate.



22
23
24
# File 'lib/deplate/mod/entities-decode.rb', line 22

def deplate
  @deplate
end

Class Method Details

.with_deplate(deplate) ⇒ Object



14
15
16
17
18
19
# File 'lib/deplate/mod/entities-decode.rb', line 14

def with_deplate(deplate)
    ent = self.instance
    deplate.formatter.setup_entities
    ent.deplate = deplate
    ent
end

Instance Method Details

#char_by_name(name) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/deplate/mod/entities-decode.rb', line 34

def char_by_name(name)
    @deplate.formatter.entities_table.each do |char, named, numbered|
        if named == name
            return char
        end
    end
    return name
end

#char_by_number(number) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/deplate/mod/entities-decode.rb', line 24

def char_by_number(number)
    @deplate.formatter.entities_table.each do |char, named, numbered|
        if numbered == number
            return char
        end
    end
    return number
end