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, expression = nil) ⇒ 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.
77 78 79 |
# File 'lib/sequel_core/core_sql.rb', line 77 def &(ce) ::Sequel::SQL::BooleanExpression.new(:AND, self, ce) end |
#case(default, expression = nil) ⇒ 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.
97 98 99 |
# File 'lib/sequel_core/core_sql.rb', line 97 def case(default, expression = nil) ::Sequel::SQL::CaseExpression.new(to_a, default, expression) end |
#sql_expr ⇒ Object
Return a Sequel::SQL::BooleanExpression created from this hash, matching all of the conditions.
103 104 105 |
# File 'lib/sequel_core/core_sql.rb', line 103 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.
109 110 111 |
# File 'lib/sequel_core/core_sql.rb', line 109 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.
115 116 117 |
# File 'lib/sequel_core/core_sql.rb', line 115 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.
84 85 86 |
# File 'lib/sequel_core/core_sql.rb', line 84 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.
90 91 92 |
# File 'lib/sequel_core/core_sql.rb', line 90 def ~ ::Sequel::SQL::BooleanExpression.from_value_pairs(self, :OR, true) end |