Sha256: 9d210d2b21c8c6cb22d48e6ef1f18df0c77149cb7d71801de45b164f1eaad8d4

Contents?: true

Size: 383 Bytes

Versions: 4

Compression:

Stored size: 383 Bytes

Contents

module Danica
  class Division < Operator
    variables :numerator, :denominator
    default_value :priority, 2
    default_value :is_grouped?, true

    def to_f
      numerator.to_f / denominator.to_f
    end

    def to_tex
      "\\frac{#{numerator.to_tex}}{#{denominator.to_tex}}"
    end

    def to_gnu
      "(#{numerator.to_gnu})/(#{denominator.to_gnu})"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
danica-2.2.1 lib/danica/division.rb
danica-2.2.0 lib/danica/division.rb
danica-2.1.1 lib/danica/division.rb
danica-2.1.0 lib/danica/division.rb