Sha256: 344ce6e9e19c862c5da88439973f6a6d9b77202f44b64744e2d2204c2775e741

Contents?: true

Size: 469 Bytes

Versions: 4

Compression:

Stored size: 469 Bytes

Contents

require 'danica/operator/chained'

module Danica
  class Sum < Operator::Chained
    default_value :priority, 1

    def +(other)
      repack(other)
    end

    private

    def tex_symbol
      '+'
    end

    def chain_operation(a, b)
      a + b
    end

    alias_method :gnu_symbol, :tex_symbol

    def join_proc(symbol)
      proc do |_, value|
        value.is_a?(Negative) || value.is_a?(PositiveNegative) ? ' ' : " #{symbol} "
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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