Sha256: c91801d47ce83fec9e98f352de1c99a61e5deaf34778b11fc75114085f86eca2

Contents?: true

Size: 518 Bytes

Versions: 50

Compression:

Stored size: 518 Bytes

Contents

module MongoModel
  module AttributeMethods
    module Query
      extend ActiveSupport::Concern
      
      included do
        attribute_method_suffix "?"
      end
      
      # Returns true if the attribute is not blank (i.e. it has some value). Otherwise returns false.
      def query_attribute(name)
        attributes.has?(name.to_sym)
      end
      
    private
      # Handle *? for method_missing.
      def attribute?(attribute_name)
        query_attribute(attribute_name)
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
mongomodel-0.5.5 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.5.4 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.5.3 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.5.2 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.5.1 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.5.0 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.9 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.8 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.7 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.6 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.5 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.4 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.3 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.2 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.1 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.4.0 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.3.6 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.3.5 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.3.4 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.3.3 lib/mongomodel/concerns/attribute_methods/query.rb