Module: Qrb::Syntax::UnnamedConstraint

Defined in:
lib/qrb/syntax/unnamed_constraint.rb

Instance Method Summary collapse

Instance Method Details

#compile(var_name) ⇒ Object



5
6
7
# File 'lib/qrb/syntax/unnamed_constraint.rb', line 5

def compile(var_name)
  { predicate: expression.compile(var_name) }
end

#to_ast(var_name) ⇒ Object



9
10
11
12
13
# File 'lib/qrb/syntax/unnamed_constraint.rb', line 9

def to_ast(var_name)
  [ :constraint,
    "default",
    [:fn, [:parameters, var_name], [:source, expression.to_s.strip]] ]
end