Class: Fixnum

### Home Classes Methods

### In Files

- lib/builder/xchar.rb

### Parent

Object

### Methods

- #xchr

### Files

- CHANGES
- MIT-LICENSE
- Rakefile
- builder-1.2.4.rdoc
- builder-2.0.0.rdoc
- builder-2.1.1.rdoc

### Class/Module Index

Quicksearch

- Builder
- Builder::BlankSlate
- Builder::IllegalBlockError
- Builder::XmlBase
- Builder::XmlEvents
- Builder::XmlMarkup
- BlankSlate
- Fixnum
- Kernel
- Module
- Object
- String
- Symbol

No matching classes.

# Fixnum

Enhance the Fixnum class with a XML escaped character conversion.

### Constants

XChar

### Public Instance Methods

xchr(escape=true) click to toggle source

XML escaped version of chr. When `escape` is set to false the CP1252 fix is still applied but utf-8 characters are not converted to character entities.

    # File lib/builder/xchar.rb, line 171
    def xchr(escape=true)
      n = XChar::CP1252[self] || self
      case n when *XChar::VALID
        XChar::PREDEFINED[n] or
          (n<128 ? n.chr : (escape ? "&##{n};" : [n].pack('U*')))
      else
        Builder::XChar::REPLACEMENT_CHAR
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.