Sha256: e231b5c1e808c5173330972b6976a52987e9c03b3746a04931a340252594d234

Contents?: true

Size: 659 Bytes

Versions: 4

Compression:

Stored size: 659 Bytes

Contents

module Danica
  class Wrapper::PlusMinus
    include BaseOperations
    include VariablesHolder

    attr_accessor :value

    default_value :priority, 2
    default_value :is_grouped?, false
    default_value :signaled?, true

    delegate :valued?, to: :value

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

    def to_f
      value.to_f
    end

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

    def to_gnu(**options)
      "+ #{wrap_as_group(value).to_gnu(options)}"
    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.7.4 lib/danica/wrapper/plus_minus.rb
danica-2.7.3 lib/danica/wrapper/plus_minus.rb
danica-2.7.2 lib/danica/wrapper/plus_minus.rb
danica-2.7.1 lib/danica/wrapper/plus_minus.rb