Sha256: 67c143039b6024ef0dfba23dc1d8b5b9148fb134a1b74bd49be9f5b05f581e0d

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

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

2 entries across 2 versions & 1 rubygems

Version Path
danica-2.7.7 lib/danica/wrapper/plus_minus.rb
danica-2.7.6 lib/danica/wrapper/plus_minus.rb