Skip to content
This repository

Fix for Ruby 1.9.3-rc1 #116

Closed
wants to merge 1 commit into from

11 participants

Pat McNally Alexander Dorofeev Vít Ondruch Barry Allard Jon Tara Daniele Spinosa 404 Sébastien Saunier Cristián Arenas Ulloa Andrea Cremaschi Ricardo Mendes
Pat McNally

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
Alexander Dorofeev

bump

Vít Ondruch

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

Vít Ondruch

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

Barry Allard

+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/

Jon Tara
jtara commented July 25, 2013

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

404

same problem under ruby 2.0.

Cristián Arenas Ulloa

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

Ricardo Mendes
Collaborator

Fixed by #143.

Ricardo Mendes locks closed this February 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 14, 2011
Pat McNally YAML::each_document has gone away in ruby 1.9.3, replaced call with l…
…oad_stream
2c7d84e
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  bin/mustache
2  bin/mustache
@@ -73,7 +73,7 @@ class Mustache
73 73
         yaml = $2.strip
74 74
         template = doc.sub($1, '')
75 75
 
76  
-        YAML.each_document(yaml) do |data|
  76
+        YAML.load_stream(yaml).each do |data|
77 77
           puts Mustache.render(template, data)
78 78
         end
79 79
       else
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.