Sha256: 5c83f77d4f674ec480bd96b3f7f8b478364b56bb5e02f62687f676ff04df94b1

Contents?: true

Size: 315 Bytes

Versions: 2

Compression:

Stored size: 315 Bytes

Contents

module Danica
  class Number
    include ActiveModel::Model

    attr_accessor :value

    delegate :to_f, to: :value

    def initialize(value)
      @value = value
    end

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

    def valued?
      value.present?
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danica-0.2.0 lib/danica/number.rb
danica-0.1.0 lib/danica/number.rb