Sha256: b1bb3d853a6851969f6fcfd0d0304ce11e888d1b1f67240d1ca9a326f6ab730a
Contents?: true
Size: 705 Bytes
Versions: 3
Compression:
Stored size: 705 Bytes
Contents
module Danica class Function class Chained < Function def to_f chain(variables.map(&:to_f)) end def to_tex (numeric_to_tex + non_numeric_variables.map(&:to_tex)).join(" #{tex_symbol} ") end private def numeric_variables variables.select { |v| v.valued? } end def non_numeric_variables variables.reject { |v| v.valued? } end def chain(numbers) numbers.inject do |a,b| chain_operation(a,b) end.to_f end def numeric_to_tex return [] if numeric_variables.empty? [ Number.new(chain(numeric_variables.map(&:to_f))).to_tex ] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danica-0.3.0 | lib/danica/function/chained.rb |
danica-0.2.0 | lib/danica/function/chained.rb |
danica-0.1.0 | lib/danica/function/chained.rb |