lib/pakyow/presenter/view.rb in pakyow-presenter-1.0.0.rc3 vs lib/pakyow/presenter/view.rb in pakyow-presenter-1.0.0.rc4
- old
+ new
@@ -120,19 +120,20 @@
# be traversed through each name. Returns a {VersionedView}.
#
def find(*names)
if names.any?
named = names.shift.to_sym
+ found = each_binding(named).map(&:itself)
- found = each_binding(named).map { |node|
- View.from_object(node)
- }
-
result = if names.empty? && !found.empty? # found everything; wrap it up
- VersionedView.new(found)
+ if found[0].is_a?(StringDoc::MetaNode)
+ VersionedView.new(View.from_object(found[0]))
+ else
+ VersionedView.new(View.from_object(StringDoc::MetaNode.new(found)))
+ end
elsif !found.empty? && names.count > 0 # descend further
- found.first.find(*names)
+ View.from_object(found[0]).find(*names)
else
nil
end
if result && block_given?
@@ -415,10 +416,13 @@
# Converts +self+ to html, rendering the view.
#
def to_html
@object.to_html
end
- alias :to_s :to_html
+
+ def to_s
+ @object.to_s
+ end
# @api private
def binding_name
label(:binding)
end