Class: Hash
- Defined in:
- lib/sequel_core/core_ext.rb,
lib/sequel_core/core_sql.rb
Direct Known Subclasses
Sequel::Model::Associations::AssociationReflection, Sequel::Model::Validation::Errors
Instance Method Summary collapse
-
#&(ce) ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching all of the conditions in this hash and the condition specified by the given argument.
-
#case(default) ⇒ Object
Return a Sequel::SQL::CaseExpression with this hash as the conditions and the given default value.
-
#sql_expr ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching all of the conditions.
-
#sql_negate ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching none of the conditions.
-
#sql_or ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching any of the conditions.
-
#|(ce) ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching all of the conditions in this hash or the condition specified by the given argument.
-
#~ ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, not matching any of the conditions.
Instance Method Details
#&(ce) ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching all of the conditions in this hash and the condition specified by the given argument.
70 71 72 |
# File 'lib/sequel_core/core_sql.rb', line 70 def &(ce) ::Sequel::SQL::BooleanExpression.new(:AND, self, ce) end |
#case(default) ⇒ Object
Return a Sequel::SQL::CaseExpression with this hash as the conditions and the given default value. Note that the order of the conditions will be arbitrary, so all conditions should be orthogonal.
90 91 92 |
# File 'lib/sequel_core/core_sql.rb', line 90 def case(default) ::Sequel::SQL::CaseExpression.new(to_a, default) end |
#sql_expr ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching all of the conditions.
96 97 98 |
# File 'lib/sequel_core/core_sql.rb', line 96 def sql_expr ::Sequel::SQL::BooleanExpression.from_value_pairs(self) end |
#sql_negate ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching none of the conditions.
102 103 104 |
# File 'lib/sequel_core/core_sql.rb', line 102 def sql_negate ::Sequel::SQL::BooleanExpression.from_value_pairs(self, :AND, true) end |
#sql_or ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching any of the conditions.
108 109 110 |
# File 'lib/sequel_core/core_sql.rb', line 108 def sql_or ::Sequel::SQL::BooleanExpression.from_value_pairs(self, :OR) end |
#|(ce) ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching all of the conditions in this hash or the condition specified by the given argument.
77 78 79 |
# File 'lib/sequel_core/core_sql.rb', line 77 def |(ce) ::Sequel::SQL::BooleanExpression.new(:OR, self, ce) end |
#~ ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, not matching any of the conditions.
83 84 85 |
# File 'lib/sequel_core/core_sql.rb', line 83 def ~ ::Sequel::SQL::BooleanExpression.from_value_pairs(self, :OR, true) end |