Skip to content

Instantly share code, notes, and snippets.

@judofyr
Created May 24, 2010 21:20
Show Gist options
  • Save judofyr/412439 to your computer and use it in GitHub Desktop.
Save judofyr/412439 to your computer and use it in GitHub Desktop.
From 443bb9adce83c139ef1896d193b6526d083044ea Mon Sep 17 00:00:00 2001
From: Magnus Holm <judofyr@gmail.com>
Date: Mon, 24 May 2010 23:19:18 +0200
Subject: [PATCH] Fixes #49
---
lib/mustache/generator.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/mustache/generator.rb b/lib/mustache/generator.rb
index 5e8c067..818c1ff 100644
--- a/lib/mustache/generator.rb
+++ b/lib/mustache/generator.rb
@@ -104,7 +104,7 @@ class Mustache
elsif v.is_a?(Proc)
v.call(#{code})
else
- v = [v] unless v.is_a?(Array) # shortcut when passed non-array
+ v = [v] if v.respond_to?(:has_key?) or !v.respond_to?(:map) # shortcut when passed non-array
v.map { |h| ctx.push(h); r = #{code}; ctx.pop; r }.join
end
end
--
1.6.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment