Class: MathViz::Operation
Overview
Base class for MathViz::Operation::Binary and MathViz::Operation::Unary
Defined Under Namespace
Instance Attribute Summary
Attributes inherited from Term
Instance Method Summary collapse
-
#color ⇒ Object
Default Graphviz node color.
-
#shape ⇒ Object
Graphviz node shape.
-
#term(x) ⇒ Object
Turn the object into a MathViz::Term (MathViz::Constant) if isn’t already a MathViz::Term.
Methods inherited from Term
binop, #data, #label, list_terms, name_terms!, #style, #to_dot, #to_i, #to_s, unop
Methods included from Measured
#per, #unit, #units, #with_units
Methods included from Units::Class
Instance Method Details
#color ⇒ Object
Default Graphviz node color.
492 493 494 |
# File 'lib/mathviz.rb', line 492 def color :red end |
#shape ⇒ Object
Graphviz node shape
487 488 489 |
# File 'lib/mathviz.rb', line 487 def shape :box end |
#term(x) ⇒ Object
Turn the object into a MathViz::Term (MathViz::Constant) if isn’t already a MathViz::Term. This allows for operator parameters to be primitive values without needing MathViz#const, MathViz#input, or units.
478 479 480 481 482 483 484 |
# File 'lib/mathviz.rb', line 478 def term(x) if (x.kind_of?(MathViz::Term)) x else MathViz::Constant.new(x) end end |