Sha256: 046ee40d2b05191f5e403b32127144e1de31571b8f83d0ca530ae253659f6973

Contents?: true

Size: 703 Bytes

Versions: 14

Compression:

Stored size: 703 Bytes

Contents

#
module ActiveLdap
  module AttributeMethods
    module Query
      extend ActiveSupport::Concern

      included do
        attribute_method_suffix '?'
      end

    protected
      def get_attribute_as_query(name, force_array=false)
        name, value = get_attribute_before_type_cast(name, force_array)
        if force_array
          value.collect {|x| !false_value?(x)}
        else
          !false_value?(value)
        end
      end

      def false_value?(value)
        value.nil? or value == false or value == [] or
          value == "false" or value == "FALSE" or value == ""
      end

      def attribute?(attr)
        return get_attribute_as_query(attr)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
activeldap-5.1.1 lib/active_ldap/attribute_methods/query.rb
activeldap-5.1.0 lib/active_ldap/attribute_methods/query.rb
activeldap-3.2.3 lib/active_ldap/attribute_methods/query.rb
powerhome-activeldap-3.2.3 lib/active_ldap/attribute_methods/query.rb
activeldap-4.0.6 lib/active_ldap/attribute_methods/query.rb
activeldap-4.0.5 lib/active_ldap/attribute_methods/query.rb
activeldap-4.0.4 lib/active_ldap/attribute_methods/query.rb
activeldap-4.0.3 lib/active_ldap/attribute_methods/query.rb
activeldap-4.0.2 lib/active_ldap/attribute_methods/query.rb
activeldap-4.0.1 lib/active_ldap/attribute_methods/query.rb
activeldap-4.0.0 lib/active_ldap/attribute_methods/query.rb
activeldap-3.2.2 lib/active_ldap/attribute_methods/query.rb
activeldap-3.2.1 lib/active_ldap/attribute_methods/query.rb
activeldap-3.2.0 lib/active_ldap/attribute_methods/query.rb