Module: UnicodeMath::Constants

Defined in:
lib/unicode_math/constants.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/unicode_math/constants.rb', line 5

def self.included(base)
  base.class_eval do
    %w(π ϖ 𝛑 𝛡 𝜋 𝜛 𝝅 𝝕 𝝿 𝞏 𝞹 𝟉).each do |pi|
      define_method(pi) do
        Math::PI
      end
    end

    %w(τ 𝛕 𝜏 𝝉 𝞃 𝞽).each do |tau|
      define_method(tau) do
        2 * Math::PI
      end
    end

    %w(ℯ 𝐞 𝑒 𝒆 𝖾 𝗲 𝘦 𝙚 𝚎 e).each do |e|
      define_method(e) do
        Math::E
      end
    end

    define_method('∞') do
      1.0 / 0
    end
  end
end