Sha256: 8ff319af7c1828726e6994284507433e12c46e5f4802b46ed2caecf184ea73c4

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

# If nil, then return a default string
#------------------------------------------------------------------------------
class NilClass # :nodoc:
  #------------------------------------------------------------------------------
  def to_s_default(default_str = 'n/a')
    default_str
  end

  #------------------------------------------------------------------------------
  def as_boolean
    false
  end

  #------------------------------------------------------------------------------
  def to_age
    0
  end

  #------------------------------------------------------------------------------
  def sql_wildcard
    '%'
  end

  #------------------------------------------------------------------------------
  def utc
    ''
  end

  # if nil + something, just return something
  #------------------------------------------------------------------------------
  def +(other)
    other
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm_ruby_extensions-1.5.0 lib/dm_ruby_extensions/extend_nil.rb