judofyr/temple — Issue #58: Uninitialized constant Temple::Mixins::CompiledDispatcher
Author: blambeau
Created: 2012-01-13 14:09:04+00:00
State: open

Hi guys!

It seems that there is a problem with autoload in temple 0.3.5 (see https://gist.github.com/1606332)

require 'temple'

# Uncomment the following line to get it work
#require 'temple/mixins/dispatcher'

class MyParser
def call(input); [:static, "Hello world"]; end
end

class MyEngine < Temple::Engine
use MyParser
generator :ArrayBuffer
end

The following backtrace shows that the Engine DSL tries to load `Temple::Generators::ArrayBuffer`, which triggers autoloading of `Temple::Generators`, which requires `CompiledDispatcher` for which no autoload rule exists.

```
~/.rvm/gems/ruby-1.9.2-p290/gems/temple-0.3.5/lib/temple/generators.rb:14:in
`': uninitialized constant Temple::Mixins::CompiledDispatcher (NameError)
from ~/.rvm/gems/ruby-1.9.2-p290/gems/temple-0.3.5/lib/temple/generators.rb:13:in `'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/temple-0.3.5/lib/temple/generators.rb:1:in `'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/temple-0.3.5/lib/temple/mixins/engine_dsl.rb:96:in `generator'
from my_engine.rb:12:in `'
from my_engine.rb:10:in `

'
```

I'm not confortable enough with the codebase to provide a pull request here...