9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/expressions/expression_helpers.rb', line 9
def type(type_expression)
value = type_expression.default_value
last_caller = caller_locations(1, 1).first
file_path = last_caller.path
start_line = last_caller.lineno
proxy = LocalProxy.new(type_expression:, name: self, file_path:, start_line:, scope: 'local type')
type_expression.validate!(value:, proxy:)
return value.value if value.is_a?(ValueExpression)
value
rescue NoMethodError
raise ConfigError, "Invalid type expression. Did you add 'using LowType::Syntax'?"
end
|