Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for Ruby 1.9.3-rc1 #116

Closed
wants to merge 1 commit into from
@patmcnally

The executable was dying on me in Ruby 1.9.3-rc1, looks like an older method in the YAML module was being used. This was causing a undefined method 'each_document' for Psych:Module (NoMethodError)

I didn't find any tests for the executable, but running this at a bash prompt in the root of the project should verify it still works with multiple documents.

cat <<data | ./bin/mustache - ./examples/simple.mustache                                                                         
---
name: Awesome
value: 200
in_ca: true
taxed_value: 20
---
name: Awesome2
value: 400
in_ca: false
---
data
@akaspin

bump

@voxik

I can confirm the issue. Can the patch be applied please? Thank you.

@voxik

BTW it was reported as an Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=859025

@steakknife

+1

Pat's patch is a good start, however it breaks default ruby on many platforms commonly used in production.

I've forked the gem and adapted the patch for compatibility. See also #143.

Gemfile:

gem 'mustache', :git => "https://github.com/steakknife/mustache.git"

One-time:

gem install mustache --source https://gems.gemfury.com/8n1rdTK8pezvcsyVmmgJ/

@jtara

The Gem available on gems.gemfury.com appears to be the unpatched version. It has the same problem, and I examined the source code. It is the original code with just the call to YAML.each_document

@404pnf

same problem under ruby 2.0.

@NinoScript

+1 ( ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13] )

@locks locks referenced this pull request
Merged

1.9.3+ YAML compatibility #143

@locks
Owner

Fixed by #143.

@locks locks closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 14, 2011
  1. @patmcnally
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  bin/mustache
View
2  bin/mustache
@@ -73,7 +73,7 @@ class Mustache
yaml = $2.strip
template = doc.sub($1, '')
- YAML.each_document(yaml) do |data|
+ YAML.load_stream(yaml).each do |data|
puts Mustache.render(template, data)
end
else
Something went wrong with that request. Please try again.