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

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

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:

  • return the string ‘nil’

API:

  • semipublic



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

def inspect
  'nil'
end

#matches?(record) ⇒ boolean

Match the record

A NullOperation matches every record.

Parameters:

  • the resource to match

Returns:

  • every record matches

API:

  • semipublic



662
663
664
# File 'lib/dm-core/query/conditions/operation.rb', line 662

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

#nil?true

Treat the operation the same as nil

Returns:

  • should be treated as nil

API:

  • semipublic



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

def nil?
  true
end

#valid?true

Test validity of the operation

A NullOperation is always valid.

Returns:

  • always valid

API:

  • semipublic



674
675
676
# File 'lib/dm-core/query/conditions/operation.rb', line 674

def valid?
  true
end