lib/shirinji/resolver.rb in shirinji-0.0.4 vs lib/shirinji/resolver.rb in shirinji-0.0.5
- old
+ new
@@ -49,11 +49,11 @@
return klass.new if params.empty?
check_params!(params)
args = params.each_with_object({}) do |(_type, arg), memo|
- memo[arg] = resolve(resolve_attribute(bean, arg))
+ memo[arg] = resolve_attribute(bean, arg)
end
klass.new(**args)
end
@@ -63,10 +63,13 @@
[klass, construct.parameters]
end
def resolve_attribute(bean, arg)
- (attr = bean.attributes[arg]) ? attr.reference : arg
+ return arg unless (attr = bean.attributes[arg])
+ return attr.value if attr.value
+
+ resolve(attr.reference)
end
def check_params!(params)
params.each do |pair|
next if ARG_TYPES.include?(pair.first)