Class: INatGet::Data::DSL::Condition::NOT

Inherits:
INatGet::Data::DSL::Condition show all
Defined in:
lib/inat-get/data/dsl/conditions/not.rb

Metadata collapse

Attributes inherited from INatGet::Data::DSL::Condition

#manager

Operators collapse

Constructor collapse

Methods inherited from INatGet::Data::DSL::Condition

#api_query, #sequel_query

Methods included from INatGet::Data::DSL

#AND, #ANYTHING, #NOT, #NOTHING, #OR, #Q, #finish_time, #get_identification, #get_observation, #get_place, #get_project, #get_taxon, #get_user, #now, #select_identifications, #select_observations, #select_places, #select_projects, #select_taxa, #select_users, #start_time, #time_range, #today, #version, #version!, #version?, #version_alias

Instance Attribute Details

#modelclass of Sequel::Model (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (class of Sequel::Model)


16
17
18
# File 'lib/inat-get/data/dsl/conditions/not.rb', line 16

def model
  @operand.model
end

#operandCondition (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



11
12
13
# File 'lib/inat-get/data/dsl/conditions/not.rb', line 11

def operand
  @operand
end

Class Method Details

.[](operand) ⇒ Condition

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/inat-get/data/dsl/conditions/not.rb', line 66

def [] operand
  case operand
  when INatGet::Data::DSL::Condition::Nothing
    INatGet::Data::DSL::ANYTHING
  when INatGet::Data::DSL::Condition::Anything
    INatGet::Data::DSL::NOTHING
  when INatGet::Data::DSL::Condition::NOT
    operand.operand
  else
    new(operand).freeze
  end
end

Instance Method Details

#!Condition

Returns:



48
49
50
# File 'lib/inat-get/data/dsl/conditions/not.rb', line 48

def !
  @operand
end

#&(other) ⇒ Condition

Returns:



30
31
32
33
34
35
36
# File 'lib/inat-get/data/dsl/conditions/not.rb', line 30

def & other
  if @operand == other
    INatGet::Data::DSL::NOTHING
  else
    AND[ self, other ]
  end
end

#==(other) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
56
57
# File 'lib/inat-get/data/dsl/conditions/not.rb', line 53

def == other
  return true if self.equal?(other)
  return false unless other.is_a?(NOT)
  self.operand == other.operand
end

#|(other) ⇒ Condition

Returns:



39
40
41
42
43
44
45
# File 'lib/inat-get/data/dsl/conditions/not.rb', line 39

def | other
  if @operand == other
    INatGet::Data::DSL::ANYTHING
  else
    OR[ self, other ]
  end
end