module MSFL::Validators::Definitions::HashKey
Public Instance Methods
Returns true if all elements of arr are logical operators, false otherwise
@param arr [Array<Symbol>] and array of symbols to check to see if all elements are logical operators @return [Bool] it is true if all the elements are logical operators, otherwise false
# File lib/msfl/validators/definitions/hash_key.rb, line 80 def all_logical_operators?(arr) arr.each do |e| return false unless logical_operators.include?(e) end true end
Returns true if all elements of arr are operators, false otherwise
@param arr [Array<Symbol>] the Array of Symbols to be checked against the operators list @return [Bool] true if all of the elements of arr are operators
# File lib/msfl/validators/definitions/hash_key.rb, line 68 def all_operators?(arr) arr.each do |e| return false unless hash_key_operators.include?(e) end true end
Returns true if any of the elements in arr are operators, otherwise false
@param arr [Array] the array of elements to check for the presence of operators @return [Bool] true if any of the elements of arr are operators
# File lib/msfl/validators/definitions/hash_key.rb, line 91 def any_operators?(arr) arr.each do |e| return true if hash_key_operators.include?(e) end false end
# File lib/msfl/validators/definitions/hash_key.rb, line 19 def binary_operators [ :in, # IN :between, # inclusive range for integers, dates, and date times :start, # a range bound inclusively to the left :end, # a range bound inclusively to the right :ellipsis2, # alias to :between :tilda, # alias to :between, :start, and :end depending on usage :eq, # == :lt, # < :lte, # <= :gt, # > :gte, # >= :neg, # logical negation ] end
# File lib/msfl/validators/definitions/hash_key.rb, line 44 def foreign_operators [ :foreign, # Defines a filter on a related item :dataset, # A foreign dataset :filter, # an explicit filter ] end
Operators still needing parsing: ellipsis2, tilda
# File lib/msfl/validators/definitions/hash_key.rb, line 15 def hash_key_operators binary_operators.concat(logical_operators).concat(partial_operators).concat(foreign_operators) end
# File lib/msfl/validators/definitions/hash_key.rb, line 52 def logical_operators [:and, :or] end
Returns true if the argument is a valid operator
@param symbol [Symbol] the value to check to see if it is an operator @return [Bool] true if the argument is a valid operator, false otherwise
# File lib/msfl/validators/definitions/hash_key.rb, line 60 def operator?(symbol) hash_key_operators.include? symbol end
# File lib/msfl/validators/definitions/hash_key.rb, line 36 def partial_operators [ :partial, # faceted / aggregate :given, # given :filter, # explicit filter ] end
# File lib/msfl/validators/definitions/hash_key.rb, line 6 def valid_hash_key?(key) self.dataset.has_operator?(key) || self.dataset.has_field?(key) end
# File lib/msfl/validators/definitions/hash_key.rb, line 10 def valid_hash_keys hash_key_operators.concat self.dataset.fields end