Sha256: a551522718cc1337c55ab12582053d0a5501a753d8b08b92021a0a7ecbc6cc26

Contents?: true

Size: 625 Bytes

Versions: 1

Compression:

Stored size: 625 Bytes

Contents

module Antrapol
  module ToolRack
    module ConditionUtils

      def is_empty?(obj)
        if not defined?(obj)
          true
        elsif obj.nil?
          true
        elsif obj.respond_to?(:empty?)
          if obj.respond_to?(:strip)
            obj.strip.empty?
          else
            obj.empty?
          end
        else
          false
        end
      end # is_empty?

      def not_empty?(obj)
        !is_empty?(obj)
      end # not empty

      def is_boolean?(val)
        !!val == val
      end
      alias_method :is_bool?, :is_boolean?

    end # ConditionUtils
  end # MyToolRack
end # Antrapol

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
toolrack-0.6.2 lib/toolrack/condition_utils.rb