Sha256: 57d0dd2297cbbb9890c4da5a04e5e4e9c1a887fb2a124f273c97261d843633b0

Contents?: true

Size: 559 Bytes

Versions: 2

Compression:

Stored size: 559 Bytes

Contents

module Danica
  class Wrapper::Number
    include BaseOperations
    include Common

    attr_accessor :value

    default_value :priority, 10
    delegate :to_f, to: :value
    default_value :is_grouped?, false

    def initialize(value)
      @value = value
    end

    def to_tex
      return value.to_i.to_s if value.to_i == value
      value.to_s
    end

    def valued?
      value.present?
    end

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

    alias_method :to_gnu, :to_tex
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danica-2.4.2 lib/danica/wrapper/number.rb
danica-2.4.1 lib/danica/wrapper/number.rb