Sha256: d504843e962ec4db99d315836a5e0c329d96b945878c5745aa2a912cc6b0fada

Contents?: true

Size: 590 Bytes

Versions: 3

Compression:

Stored size: 590 Bytes

Contents

module Danica
  class Wrapper::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

3 entries across 3 versions & 1 rubygems

Version Path
danica-2.4.0 lib/danica/wrapper/number.rb
danica-2.3.1 lib/danica/wrapper/number.rb
danica-2.3.0 lib/danica/wrapper/number.rb