Module: Finitio::Syntax::NamedConstraint
- Includes:
- Node
- Defined in:
- lib/finitio/syntax/type/named_constraint.rb
Instance Method Summary
collapse
Methods included from Node
included, #metadata, #resolve_ruby_const, #unique_names!
Instance Method Details
#compile(var_name) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/finitio/syntax/type/named_constraint.rb', line 9
def compile(var_name)
p = expression.compile(var_name)
n = constraint_name.to_sym
m = metadata
Constraint.new(p, n, metadata)
end
|
#to_ast(var_name) ⇒ Object
16
17
18
19
20
|
# File 'lib/finitio/syntax/type/named_constraint.rb', line 16
def to_ast(var_name)
[ :constraint,
constraint_name,
[:fn, [:parameters, var_name], [:source, expression.to_str.strip]] ]
end
|