Sha256: fca80f637dca4768d91a2bb3738a23b187dfdb97c9085931d8000a27443f8535
Contents?: true
Size: 1015 Bytes
Versions: 2
Compression:
Stored size: 1015 Bytes
Contents
# frozen_string_literal: true module Danica class Wrapper::Constant include BaseOperations include Common attr_reader :value, :latex, :gnuplot default_value :priority, 10 default_value :valued?, true default_value :is_grouped?, false default_value :constant?, true 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 def to_f value.to_f end def ==(other) return false unless other.class == self.class gnuplot == other.gnuplot && latex == other.latex && value == other.value end def to_tex(**_options) latex.to_s end def to_gnu(**_options) gnuplot.to_s end private attr_writer :value attr_writer :latex attr_writer :gnuplot end E = Wrapper::Constant.new(Math::E, :e, 'exp(1)') PI = Wrapper::Constant.new(Math::PI, '\pi', :pi) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
danica-2.7.7 | lib/danica/wrapper/constant.rb |
danica-2.7.6 | lib/danica/wrapper/constant.rb |