Module: MSFL::Validators::Definitions::HashKey
- Included in:
- Converters::Operator, Datasets::Base, Semantic
- Defined in:
- lib/msfl/validators/definitions/hash_key.rb
Instance Method Summary collapse
-
#all_logical_operators?(arr) ⇒ Bool
Returns true if all elements of arr are logical operators, false otherwise.
-
#all_operators?(arr) ⇒ Bool
Returns true if all elements of arr are operators, false otherwise.
-
#any_operators?(arr) ⇒ Bool
Returns true if any of the elements in arr are operators, otherwise false.
- #binary_operators ⇒ Object
-
#hash_key_operators ⇒ Object
Operators still needing parsing: ellipsis2, tilda.
- #logical_operators ⇒ Object
- #valid_hash_key?(key) ⇒ Boolean
- #valid_hash_keys ⇒ Object
Instance Method Details
#all_logical_operators?(arr) ⇒ Bool
Returns true if all elements of arr are logical operators, false otherwise
56 57 58 59 60 61 |
# File 'lib/msfl/validators/definitions/hash_key.rb', line 56 def all_logical_operators?(arr) arr.each do |e| return false unless logical_operators.include?(e) end true end |
#all_operators?(arr) ⇒ Bool
Returns true if all elements of arr are operators, false otherwise
44 45 46 47 48 49 |
# File 'lib/msfl/validators/definitions/hash_key.rb', line 44 def all_operators?(arr) arr.each do |e| return false unless hash_key_operators.include?(e) end true end |
#any_operators?(arr) ⇒ Bool
Returns true if any of the elements in arr are operators, otherwise false
67 68 69 70 71 72 |
# File 'lib/msfl/validators/definitions/hash_key.rb', line 67 def any_operators?(arr) arr.each do |e| return true if hash_key_operators.include?(e) end false end |
#binary_operators ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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 |
#hash_key_operators ⇒ Object
Operators still needing parsing: ellipsis2, tilda
15 16 17 |
# File 'lib/msfl/validators/definitions/hash_key.rb', line 15 def hash_key_operators binary_operators.concat(logical_operators) end |
#logical_operators ⇒ Object
36 37 38 |
# File 'lib/msfl/validators/definitions/hash_key.rb', line 36 def logical_operators [:and, :or] end |
#valid_hash_key?(key) ⇒ Boolean
6 7 8 |
# File 'lib/msfl/validators/definitions/hash_key.rb', line 6 def valid_hash_key?(key) valid_hash_keys.include? key end |
#valid_hash_keys ⇒ Object
10 11 12 |
# File 'lib/msfl/validators/definitions/hash_key.rb', line 10 def valid_hash_keys hash_key_operators.concat self.dataset.fields end |