Class: DataMapper::Query::Conditions::NullOperation

Inherits:
AbstractOperation show all
Defined in:
lib/dm-core/query/conditions/operation.rb

Overview

class NotOperation

Instance Attribute Summary

Attributes inherited from AbstractOperation

#operands, #parent

Instance Method Summary collapse

Methods inherited from AbstractOperation

#<<, #clear, descendants, #difference, #each, #empty?, #first, inherited, #intersection, #merge, #minimize, #negated?, #one?, #slug, slug, #sorted_operands, #to_s, #union

Methods included from Equalizer

#equalize

Methods included from Assertions

#assert_kind_of

Instance Method Details

#inspectString

Inspecting the operation should return the same as nil

Returns:

  • (String)

    return the string ‘nil’



702
703
704
# File 'lib/dm-core/query/conditions/operation.rb', line 702

def inspect
  'nil'
end

#matches?(record) ⇒ true

Match the record

A NullOperation matches every record.

Parameters:

  • record (Resource, Hash)

    the resource to match

Returns:

  • (true)

    every record matches



670
671
672
# File 'lib/dm-core/query/conditions/operation.rb', line 670

def matches?(record)
  record.kind_of?(Hash) || record.kind_of?(Resource)
end

#nil?true

Treat the operation the same as nil

Returns:

  • (true)

    should be treated as nil



692
693
694
# File 'lib/dm-core/query/conditions/operation.rb', line 692

def nil?
  true
end

#valid?true

Test validity of the operation

A NullOperation is always valid.

Returns:

  • (true)

    always valid



682
683
684
# File 'lib/dm-core/query/conditions/operation.rb', line 682

def valid?
  true
end