lib/yaks/mapper.rb in yaks-0.7.5 vs lib/yaks/mapper.rb in yaks-0.7.6
- old
+ new
@@ -53,18 +53,16 @@
def load_attribute(name)
respond_to?(name) ? public_send(name) : object.public_send(name)
end
alias load_association load_attribute
+ def expand_value(value)
+ Resolve(value, self)
+ end
+
def expand_uri(uri, expand)
- case uri
- when nil
- return
- when Symbol
- return load_attribute(uri)
- when Method, Proc
- return Resolve(uri, self)
- end
+ return if uri.nil?
+ return Resolve(uri, self) if uri.respond_to?(:to_proc)
template = URITemplate.new(uri)
expand_vars = case expand
when true
template.variables