Class: Danica::Wrapper::Variable
- Inherits:
-
Object
- Object
- Danica::Wrapper::Variable
- Includes:
- BaseOperations, Common
- Defined in:
- lib/danica/wrapper/variable.rb
Instance Attribute Summary collapse
-
#gnuplot ⇒ Object
Returns the value of attribute gnuplot.
-
#latex ⇒ Object
Returns the value of attribute latex.
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(*args) ⇒ Variable
constructor
A new instance of Variable.
- #to_f ⇒ Object
- #to_gnu(**options) ⇒ Object
- #to_tex(**options) ⇒ Object
Methods included from Common
#content, #formatted, #gnu, #tex, #to, #valued?
Methods included from BaseOperations
Constructor Details
#initialize(*args) ⇒ Variable
Returns a new instance of Variable.
15 16 17 18 19 20 21 22 |
# File 'lib/danica/wrapper/variable.rb', line 15 def initialize(*args) attrs = args. attrs = args.as_hash(%i[name value latex gnuplot]).merge(attrs) attrs.each do |key, value| public_send("#{key}=", value) end end |
Instance Attribute Details
#gnuplot ⇒ Object
Returns the value of attribute gnuplot.
8 9 10 |
# File 'lib/danica/wrapper/variable.rb', line 8 def gnuplot @gnuplot end |
#latex ⇒ Object
Returns the value of attribute latex.
8 9 10 |
# File 'lib/danica/wrapper/variable.rb', line 8 def latex @latex end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/danica/wrapper/variable.rb', line 8 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/danica/wrapper/variable.rb', line 9 def value @value end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/danica/wrapper/variable.rb', line 28 def ==(other) return false unless other.class == self.class other.value == value && other.name == name && other.latex == latex && other.gnuplot == gnuplot end |
#to_f ⇒ Object
24 25 26 |
# File 'lib/danica/wrapper/variable.rb', line 24 def to_f value.nil? ? raise(Exception::NotDefined) : value.to_f end |
#to_gnu(**options) ⇒ Object
43 44 45 46 47 |
# File 'lib/danica/wrapper/variable.rb', line 43 def to_gnu(**) return value.to_gnu() if value (gnuplot || name).to_s end |
#to_tex(**options) ⇒ Object
37 38 39 40 41 |
# File 'lib/danica/wrapper/variable.rb', line 37 def to_tex(**) return value.to_tex() if value (latex || name).to_s end |