Sha256: b67ed82e7b117dbd00f6e4779364d3e1b8f004149c7e407b0bfea534416b6820
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
module Danica class Wrapper::Variable include BaseOperations include Common attr_accessor :value, :name, :latex, :gnu default_value :priority, 10 default_value :is_grouped?, false default_value :variable?, true def initialize(*args) attrs = args.extract_options! attrs = args.as_hash(%i(name value latex gnu)).merge(attrs) attrs.each do |key, value| self.public_send("#{key}=", value) end end def to_f value.nil? ? raise(Exception::NotDefined) : value.to_f end def ==(other) return false unless other.class == self.class 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 value=(value) @value = value.is_a?(Numeric) ? number(value) : value end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danica-2.6.4 | lib/danica/wrapper/variable.rb |
danica-2.6.3 | lib/danica/wrapper/variable.rb |
danica-2.6.2 | lib/danica/wrapper/variable.rb |