In Files

Parent

Files

MathViz::Constant

A simple number.

Also identifies the number as true constant, which affects nodes display style, so that opportunities for constant-folding can be idenified.

Public Class Methods

new(a) click to toggle source

wraps a primitive value

# File lib/mathviz.rb, line 508
def initialize(a)
  super()
  @a = a
end

Public Instance Methods

constant?() click to toggle source
# File lib/mathviz.rb, line 538
def constant?
  true
end
finite?() click to toggle source

Forward to contained object

# File lib/mathviz.rb, line 543
def finite?
  @a.respond_to?(:finite?) ? @a.finite? : true
end
long() click to toggle source

Debugging method; string with both name and value

# File lib/mathviz.rb, line 514
def long
  n = @name && (@name + " = ")
  "(#{n}#{to_value})"
end
shape() click to toggle source

Graphviz node shape

# File lib/mathviz.rb, line 534
def shape
  :plaintext
end
to_value() click to toggle source

Forward to contained object

# File lib/mathviz.rb, line 520
def to_value
  @a.to_value
end
units() click to toggle source

Returns the units of the contained object (if any) or else it’s own.

# File lib/mathviz.rb, line 525
def units
  if @a.respond_to? :units
    @a.units
  else
    super
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.