Sha256: 896f52a876d9650df9ae14a47b789c8868cda32d093957eab55ba2ddbc7c9da2

Contents?: true

Size: 566 Bytes

Versions: 9

Compression:

Stored size: 566 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(_)
      return value.to_i.to_s if value.to_i == value
      value.to_s
    end

    def valued?
      value.present?
    end

    def signaled?
      value < 0
    end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
danica-2.6.4 lib/danica/wrapper/number.rb
danica-2.6.3 lib/danica/wrapper/number.rb
danica-2.6.2 lib/danica/wrapper/number.rb
danica-2.6.1 lib/danica/wrapper/number.rb
danica-2.6.0 lib/danica/wrapper/number.rb
danica-2.5.1 lib/danica/wrapper/number.rb
danica-2.5.0 lib/danica/wrapper/number.rb
danica-2.4.4 lib/danica/wrapper/number.rb
danica-2.4.3 lib/danica/wrapper/number.rb