Sha256: 464421a2c021ea0ebf1bbe2d9c0e2675ed5abe6d945cd5bc1ff7ef4cbda33a8e

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

module Danica
  class Negative <  Common
    include ActiveModel::Model

    attr_accessor :value
    
    delegate :valued?, to: :value

    def initialize(value)
      @value = wrap_value(value)
    end

    def to_f
      -value.to_f
    end

    def to_tex
      "-#{value.to_tex}"
    end

    def to_gnu
      "-#{value.to_gnu}"
    end

    def ==(other)
      return false unless other.class == self.class
      value == other.value
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danica-2.0.5 lib/danica/negative.rb
danica-2.0.4 lib/danica/negative.rb