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'


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

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


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

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


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

def nil?
  true
end

#valid?true

Test validity of the operation

A NullOperation is always valid.

Returns:

  • (true)

    always valid


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

def valid?
  true
end