Sha256: c4e5cf0bf9a851ee8d24f70ffff29857259bef503b131a9eab089656450159a7

Contents?: true

Size: 638 Bytes

Versions: 3

Compression:

Stored size: 638 Bytes

Contents

module Danica
  class Wrapper::PlusMinus
    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

3 entries across 3 versions & 1 rubygems

Version Path
danica-2.4.0 lib/danica/wrapper/plus_minus.rb
danica-2.3.1 lib/danica/wrapper/plus_minus.rb
danica-2.3.0 lib/danica/wrapper/plus_minus.rb