Class Index [+]

Quicksearch

DataMapper::Ext

Public Class Methods

blank?(value) click to toggle source

Determines whether the specified value is blank.

An object is blank if it’s false, empty, or a whitespace string. For example, “”, “ “, nil, [], and {} are blank.

@api semipublic

    # File lib/dm-core/support/ext/blank.rb, line 9
 9:     def self.blank?(value)
10:       return value.blank? if value.respond_to?(:blank?)
11:       case value
12:       when ::NilClass, ::FalseClass
13:         true
14:       when ::TrueClass, ::Numeric
15:         false
16:       when ::Array, ::Hash
17:         value.empty?
18:       when ::String
19:         value !~ /\S/
20:       else
21:         value.nil? || (value.respond_to?(:empty?) && value.empty?)
22:       end
23:     end
try_dup(value) click to toggle source
    # File lib/dm-core/support/ext/try_dup.rb, line 3
 3:     def self.try_dup(value)
 4:       case value
 5:       when ::TrueClass, ::FalseClass, ::NilClass, ::Module, ::Numeric, ::Symbol
 6:         value
 7:       else
 8:         value.dup
 9:       end
10:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.