Class: INatGet::Data::DSL::Condition::OR
- Inherits:
-
INatGet::Data::DSL::Condition
- Object
- INatGet::Data::DSL::Condition
- INatGet::Data::DSL::Condition::OR
- Defined in:
- lib/inat-get/data/dsl/conditions/or.rb
Metadata collapse
- #model ⇒ class of Sequel::Model readonly private
- #operands ⇒ Array<Condition> readonly private
Attributes inherited from INatGet::Data::DSL::Condition
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
#model ⇒ class 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.
16 17 18 |
# File 'lib/inat-get/data/dsl/conditions/or.rb', line 16 def model @operands.map(&:model).find { |h| !h.nil? } end |
#operands ⇒ Array<Condition> (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.
11 12 13 |
# File 'lib/inat-get/data/dsl/conditions/or.rb', line 11 def operands @operands end |
Class Method Details
.[](*operands) ⇒ Condition
52 53 54 55 56 57 58 |
# File 'lib/inat-get/data/dsl/conditions/or.rb', line 52 def [] *operands return INatGet::Data::DSL::NOTHING if operands.empty? return INatGet::Data::DSL::ANYTHING if operands.include?(INatGet::Data::DSL::ANYTHING) operands.delete INatGet::Data::DSL::NOTHING return operands.first if operands.size == 1 new(*operands).freeze end |
Instance Method Details
#==(other) ⇒ Boolean
39 40 41 42 43 |
# File 'lib/inat-get/data/dsl/conditions/or.rb', line 39 def == other return true if self.equal?(other) return false unless other.is_a?(OR) self.operands.all? { |o| other.operands.include?(o) } && other.operands.all? { |o| self.operands.include?(o) } end |