Sha256: 43bcab391c129531bad2eb95b8d4645ca284d8cdf27765e5a5fca58698bcbf88

Contents?: true

Size: 492 Bytes

Versions: 2

Compression:

Stored size: 492 Bytes

Contents

module Danica
  class Number
    include ActiveModel::Model
    include BaseOperations

    attr_accessor :value

    delegate :to_f, to: :value

    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.0.5 lib/danica/number.rb
danica-2.0.4 lib/danica/number.rb