Sha256: 6dcf1b9999d502d9962ca36d4c7ff47588256ef8e8d015ab5ebc77107bb41065

Contents?: true

Size: 587 Bytes

Versions: 5

Compression:

Stored size: 587 Bytes

Contents

# encoding: utf-8
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)

##
# Object extension.
#

class Object
    ##
    # Indicates object is in some object which supports +#include?+.
    #
    # @param [Object] range container for analyzing
    # @return [Boolean] +true+ if yes, +false+ in otherwise
    # @since 0.8.0
    #
    
    def in?(range)
        range.include? self
    end

    ##
    # Converts object to Boolean according to Ruby conversion rules.
    #
    # @return [Boolean] +true+ or +false+
    # @since 0.7.0
    #
    
    def to_b
        !!self
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hash-utils-0.11.1 lib/hash-utils/object.rb
hash-utils-0.11.0 lib/hash-utils/object.rb
hash-utils-0.10.0 lib/hash-utils/object.rb
hash-utils-0.9.0 lib/hash-utils/object.rb
hash-utils-0.8.0 lib/hash-utils/object.rb