Class: Ovec::MathNode

Inherits:
Node
  • Object
show all
Defined in:
lib/ovec/nodes.rb

Constant Summary collapse

INLINE =
:inline
DISPLAY =
:display

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, content) ⇒ MathNode

Returns a new instance of MathNode.



71
72
73
74
# File 'lib/ovec/nodes.rb', line 71

def initialize(type, content)
	@type = type
	@content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



85
86
87
# File 'lib/ovec/nodes.rb', line 85

def content
  @content
end

#typeObject (readonly)

Returns the value of attribute type.



84
85
86
# File 'lib/ovec/nodes.rb', line 84

def type
  @type
end

Instance Method Details

#to_texObject



76
77
78
79
80
81
82
# File 'lib/ovec/nodes.rb', line 76

def to_tex
	if type == INLINE
		"$#{content}$"
	else
		"$$#{content}$$"
	end
end