Class: Danica::Wrapper::Constant

Inherits:
Object
  • Object
show all
Includes:
BaseOperations, Common
Defined in:
lib/danica/wrapper/constant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common

#content, #formatted, #gnu, #tex, #to, #valued?

Methods included from BaseOperations

#*, #**, #+, #-, #-@, #/

Constructor Details

#initialize(*args) ⇒ Constant

Returns a new instance of Constant.



15
16
17
18
19
20
21
22
# File 'lib/danica/wrapper/constant.rb', line 15

def initialize(*args)
  attrs = args.extract_options!
  attrs = args.as_hash(%i[value latex gnuplot]).merge(attrs)

  attrs.each do |key, value|
    send("#{key}=", value)
  end
end

Instance Attribute Details

#gnuplotObject

Returns the value of attribute gnuplot.



8
9
10
# File 'lib/danica/wrapper/constant.rb', line 8

def gnuplot
  @gnuplot
end

#latexObject

Returns the value of attribute latex.



8
9
10
# File 'lib/danica/wrapper/constant.rb', line 8

def latex
  @latex
end

#valueObject

Returns the value of attribute value.



8
9
10
# File 'lib/danica/wrapper/constant.rb', line 8

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
31
32
# File 'lib/danica/wrapper/constant.rb', line 28

def ==(other)
  return false unless other.class == self.class

  gnuplot == other.gnuplot && latex == other.latex && value == other.value
end

#to_fObject



24
25
26
# File 'lib/danica/wrapper/constant.rb', line 24

def to_f
  value.to_f
end

#to_gnu(**_options) ⇒ Object



38
39
40
# File 'lib/danica/wrapper/constant.rb', line 38

def to_gnu(**_options)
  gnuplot.to_s
end

#to_tex(**_options) ⇒ Object



34
35
36
# File 'lib/danica/wrapper/constant.rb', line 34

def to_tex(**_options)
  latex.to_s
end