Module: BabySqueel::Operators::ArelAliasing

Included in:
Nodes::Node, Comparison, Equality, Grouping, Matching
Defined in:
lib/baby_squeel/operators.rb

Instance Method Summary collapse

Instance Method Details

#arel_alias(operator, arel_name) ⇒ Object

Allows the creation of shorthands for Arel methods.

Arguments

  • operator - A custom operator.

  • arel_name - The name of the Arel method you want to alias.

Example

BabySqueel::Nodes::Node.arel_alias :unlike, :does_not_match
Post.where.has { title.unlike 'something' }


15
16
17
18
19
# File 'lib/baby_squeel/operators.rb', line 15

def arel_alias(operator, arel_name)
  define_method operator do |other|
    send(arel_name, other)
  end
end