Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

undefined method `empty?' for nil:NilClass #44

Open
jamesarosen opened this issue May 11, 2011 · 8 comments
Open

undefined method `empty?' for nil:NilClass #44

jamesarosen opened this issue May 11, 2011 · 8 comments

Comments

@jamesarosen
Copy link

Stack trace:

undefined method `empty?' for nil:NilClass
/Users/jamesrosen/.rvm/gems/ree-1.8.7-2011.03/gems/rocco-0.6/lib/rocco/layout.rb:30:in `sections'
/Users/jamesrosen/.rvm/gems/ree-1.8.7-2011.03/gems/rocco-0.6/lib/rocco/layout.rb:20:in `map'
/Users/jamesrosen/.rvm/gems/ree-1.8.7-2011.03/gems/rocco-0.6/lib/rocco/layout.rb:20:in `sections'
/Users/jamesrosen/.rvm/gems/ree-1.8.7-2011.03/gems/mustache-0.99.3/lib/mustache/context.rb:135:in `[]'
...

I'm using a custom language definition:

Rocco::COMMENT_STYLES['double-rb'] = {
  :single => "##",
  :multi  => { :start => '=begin', :middle => nil, :end => '=end' }
}

This allows me to differentiate between public API (## lines) and private API (# lines). Otherwise, nothing remarkable.

@jamesarosen
Copy link
Author

Adding code ||= '' to Rocco::Layout#sections fixes the problem, but I bet there's an underlying cause I'm not seeing.

@Wilfred
Copy link

Wilfred commented May 15, 2011

I'm seeing the same issue with some Python files I'm running Rocco on. The simplest test case I could find was:

""":
"""
f

@jamesarosen
Copy link
Author

Possibly the same as #40

@zpatten
Copy link

zpatten commented Jun 1, 2011


/home/zpatten/.rvm/gems/ree-1.8.7-2011.03/gems/rocco-0.7/lib/rocco/layout.rb:30:in `sections': undefined method `empty?' for nil:NilClass (NoMethodError)
    from /home/zpatten/.rvm/gems/ree-1.8.7-2011.03/gems/rocco-0.7/lib/rocco/layout.rb:20:in `map'
    from /home/zpatten/.rvm/gems/ree-1.8.7-2011.03/gems/rocco-0.7/lib/rocco/layout.rb:20:in `sections'
    from /home/zpatten/.rvm/gems/ree-1.8.7-2011.03/gems/mustache-0.99.4/lib/mustache/context.rb:135:in `[]'

I'm seeing this issue with some Ruby files in a Rails lib folder. Default Rocco, no customization.

@rtomayko
Copy link
Owner

Did this commit fix the issue for you guys?

4c4ef24

I'm shipping out an 0.8 release that includes it now.

@jamesarosen
Copy link
Author

Sadly, I can't say for sure. We had to remove Rocco because it kept causing the following error in our application (see #45):

ArgumentError: wrong number of arguments (0 for 1)
[PROJECT_ROOT]/vendor/bundle/ruby/1.8/gems/activerecord-2.3.10/lib/active_record/named_scope.rb, line 186

We tried moving Rocco to its own bundler group, but that didn't help.

@zpatten
Copy link

zpatten commented Jun 20, 2011

I encountered this error running against our (large) code base. This completely resolved the issue for us.

@Wilfred
Copy link

Wilfred commented Jun 22, 2011

No, the issue remains. The test case I gave above still produces the error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants