Sha256: ed2c3bf6c4348318ee52da10de99784a0c9c7a67b7175871abfc297b497c5770

Contents?: true

Size: 636 Bytes

Versions: 4

Compression:

Stored size: 636 Bytes

Contents

module Danica
  class PositiveNegative
    include Common
    include BaseOperations
    include VariablesHolder
    include ActiveModel::Model

    attr_accessor :value

    default_value :priority, 2
    default_value :is_grouped?, false
    
    delegate :valued?, to: :value

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

    def to_f
      value.to_f
    end

    def to_tex
      "\\pm #{wrap_as_group(value).to_tex}"
    end

    def to_gnu
      "+ #{wrap_as_group(value).to_gnu}"
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

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