Class: Danica::Variable

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/danica/variable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gnuObject

Returns the value of attribute gnu.



4
5
6
# File 'lib/danica/variable.rb', line 4

def gnu
  @gnu
end

#latexObject

Returns the value of attribute latex.



4
5
6
# File 'lib/danica/variable.rb', line 4

def latex
  @latex
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/danica/variable.rb', line 4

def name
  @name
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/danica/variable.rb', line 4

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/danica/variable.rb', line 10

def ==(other)
  return false unless other.class == Variable
  return other.value == value &&
         other.name == name &&
         other.latex == latex &&
         other.gnu == gnu
end

#to_fObject



6
7
8
# File 'lib/danica/variable.rb', line 6

def to_f
  value.nil? ? raise(Exception::NotDefined) : value.to_f
end

#to_gnuObject



23
24
25
26
# File 'lib/danica/variable.rb', line 23

def to_gnu
  return value.to_gnu if value
  (gnu || name).to_s
end

#to_texObject



18
19
20
21
# File 'lib/danica/variable.rb', line 18

def to_tex
  return value.to_tex if value
  (latex || name).to_s
end

#valued?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/danica/variable.rb', line 28

def valued?
  value.present?
end