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.3.2 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.3.1 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.3.0 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.20 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.19 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.18 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.17 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.16 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.15 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.14 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.13 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.12 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.11 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.10 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.9 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.8 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.7 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.6 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.5 lib/mongomodel/concerns/attribute_methods/query.rb
mongomodel-0.2.4 lib/mongomodel/concerns/attribute_methods/query.rb