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.



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

def deplate
  @deplate
end

Class Method Details

.with_deplate(deplate) ⇒ Object



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

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

Instance Method Details

#char_by_name(name) ⇒ Object



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

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



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

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