Sha256: 519d02e7eb80c259f5d995e9d86ab22cce9135a383bc96ab4ee0c61be88042cb

Contents?: true

Size: 920 Bytes

Versions: 10

Compression:

Stored size: 920 Bytes

Contents

#
# Copyright 2013-2014, Seth Vargo <sethvargo@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

class Object
  # An object is blank if it's false, empty, or a whitespace string.
  # This is implemented in rails.
  #
  # @example foo.nil? || foo.empty? can be replaced by foo.blank?
  #
  # @return [true, false]
  def blank?
    respond_to?(:empty?) ? empty? : !self
  end unless method_defined?(:blank?)
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
chef-sugar-2.5.0 lib/chef/sugar/core_extensions/object.rb
chef-sugar-2.4.1 lib/chef/sugar/core_extensions/object.rb
chef-sugar-2.4.0 lib/chef/sugar/core_extensions/object.rb
chef-sugar-2.3.2 lib/chef/sugar/core_extensions/object.rb
chef-sugar-2.3.1 lib/chef/sugar/core_extensions/object.rb
chef-sugar-2.3.0 lib/chef/sugar/core_extensions/object.rb
chef-sugar-2.2.0 lib/chef/sugar/core_extensions/object.rb
chef-sugar-2.1.0 lib/chef/sugar/core_extensions/object.rb
chef-sugar-2.0.0 lib/chef/sugar/core_extensions/object.rb
chef-sugar-1.3.0 lib/chef/sugar/core_extensions/object.rb