Module: Mml::Base::Mtext

Included in:
V2::Mtext, V3::Mtext, V4::Mtext
Defined in:
lib/mml/base/mtext.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

NOTE: class_eval resolves constants in module’s lexical scope. Use fully qualified names (e.g., Mml::Namespace).



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mml/base/mtext.rb', line 8

def self.included(klass)
  klass.class_eval do
    attribute :value, :string
    attribute :mathcolor, :string
    attribute :mathbackground, :string
    attribute :mathvariant, :string
    attribute :mathsize, :string

    xml do
      namespace Mml::Namespace
      element "mtext"

      map_content to: :value
      map_attribute "mathcolor", to: :mathcolor
      map_attribute "mathbackground", to: :mathbackground
      map_attribute "mathvariant", to: :mathvariant
      map_attribute "mathsize", to: :mathsize
    end
  end
end