Sha256: 9dac34992abe7e44cc0c3d3a4e8690822c59cdd72bb63a113f0378b60c80ef9c
Contents?: true
Size: 756 Bytes
Versions: 4
Compression:
Stored size: 756 Bytes
Contents
module Danica class Variable include ActiveModel::Model include BaseOperations attr_accessor :value, :name, :latex, :gnu def to_f value.nil? ? raise(Exception::NotDefined) : value.to_f end def ==(other) return false unless other.class == Variable return other.value == value && other.name == name && other.latex == latex && other.gnu == gnu end def to_tex return value.to_tex if value (latex || name).to_s end def to_gnu return value.to_gnu if value (gnu || name).to_s end def valued? value.present? end def value=(value) @value = value.is_a?(Numeric) ? Number.new(value) : value end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
danica-2.0.5 | lib/danica/variable.rb |
danica-2.0.4 | lib/danica/variable.rb |
danica-2.0.3 | lib/danica/variable.rb |
danica-2.0.2 | lib/danica/variable.rb |