### Home Classes Methods

### In Files

- lib/math_ml/element.rb

### Parent

MathML::Element

### Methods

- ::new
- #sub=
- #sup=
- #update
- #update_contents
- #update_name

### Class/Module Index

Quicksearch

- MathML
- MathML::Align
- MathML::Element
- MathML::Error
- MathML::Fenced
- MathML::Frac
- MathML::Identifier
- MathML::LaTeX
- MathML::LaTeX::BlockNotClosed
- MathML::LaTeX::Builtin
- MathML::LaTeX::Builtin::Symbol
- MathML::LaTeX::BuiltinCommands
- MathML::LaTeX::BuiltinEnvironments
- MathML::LaTeX::BuiltinGroups
- MathML::LaTeX::BuiltinGroups::CircularReferenceEnvironment
- MathML::LaTeX::EndMismatchToBegin
- MathML::LaTeX::EnvironmentNotEnd
- MathML::LaTeX::Font
- MathML::LaTeX::Macro
- MathML::LaTeX::Macro::Command
- MathML::LaTeX::Macro::Environment
- MathML::LaTeX::NeedParameter
- MathML::LaTeX::NotEnvironment
- MathML::LaTeX::OptionNotClosed
- MathML::LaTeX::ParseError
- MathML::LaTeX::Parser
- MathML::LaTeX::Parser::CircularReferenceCommand
- MathML::LaTeX::RE
- MathML::LaTeX::Scanner
- MathML::Line
- MathML::Math
- MathML::None
- MathML::Number
- MathML::Operator
- MathML::Over
- MathML::Root
- MathML::Row
- MathML::Space
- MathML::Sqrt
- MathML::String
- MathML::SubSup
- MathML::Symbol
- MathML::Symbol::CharacterReference
- MathML::Symbol::EntityReference
- MathML::Table
- MathML::Td
- MathML::Text
- MathML::Tr
- MathML::Under
- MathML::Util
- MathML::Util::MathData
- MathML::Util::SimpleLaTeX
- MathML::Variant
- MathML::XMLElement
- String

No matching classes.

# MathML::SubSup

### Attributes

body[R]
sub[R]
sup[R]

### Public Class Methods

new(display_style, body) click to toggle source

    # File lib/math_ml/element.rb, line 87
    def initialize(display_style, body)
            super("mrow")
            as_display_style if display_style
            @body = body
    end

### Public Instance Methods

sub=(sub) click to toggle source

    # File lib/math_ml/element.rb, line 119
    def sub=(sub)
            @sub = sub
            update
    end

sup=(sup) click to toggle source

    # File lib/math_ml/element.rb, line 124
    def sup=(sup)
            @sup = sup
            update
    end

### Private Instance Methods

update() click to toggle source

    # File lib/math_ml/element.rb, line 113
    def update
            update_name
            update_contents
    end

update_contents() click to toggle source

    # File lib/math_ml/element.rb, line 105
    def update_contents
            contents.clear
            contents << @body
            contents << @sub if @sub
            contents << @sup if @sup
    end

update_name() click to toggle source

    # File lib/math_ml/element.rb, line 93
    def update_name
            if @sub || @sup
                    name = "m"
                    name << (@sub ? (@display_style ? "under" : "sub") : "")
                    name << (@sup ? (@display_style ? "over" : "sup") : "")
            else
                    name = "mrow"
            end
            self.name = name
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.