Sha256: 44c6f88a12dea5aaafbb5ea066166d3ac957ad932f527d9795f239442e35fa2b

Contents?: true

Size: 581 Bytes

Versions: 5

Compression:

Stored size: 581 Bytes

Contents

module Danica
  class Number
    include ActiveModel::Model
    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

5 entries across 5 versions & 1 rubygems

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