systemed / glug

Text-based markup for Mapbox GL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ruby error with example glug

buma opened this issue · comments

I tried example glug in readme and I get an error:

/home/mabu/.gem/ruby/2.2.0/gems/glug-0.0.2/bin/glug:5:in `instance_eval': undefined method `[]' for nil:NilClass (NoMethodError)
    from /home/mabu/.gem/ruby/2.2.0/gems/glug-0.0.2/lib/glug.rb:87:in `new'
    from /home/mabu/.gem/ruby/2.2.0/gems/glug-0.0.2/lib/glug.rb:87:in `layer'
    from (eval):5:in `block in <top (required)>'
    from /home/mabu/.gem/ruby/2.2.0/gems/glug-0.0.2/bin/glug:5:in `instance_eval'
    from /home/mabu/.gem/ruby/2.2.0/gems/glug-0.0.2/bin/glug:5:in `block in <top (required)>'
    from /home/mabu/.gem/ruby/2.2.0/gems/glug-0.0.2/lib/glug.rb:71:in `instance_eval'
    from /home/mabu/.gem/ruby/2.2.0/gems/glug-0.0.2/lib/glug.rb:71:in `initialize'
    from /home/mabu/.gem/ruby/2.2.0/gems/glug-0.0.2/bin/glug:5:in `new'
    from /home/mabu/.gem/ruby/2.2.0/gems/glug-0.0.2/bin/glug:5:in `<top (required)>'
    from /home/mabu/.gem/ruby/2.2.0/bin/glug:23:in `load'
    from /home/mabu/.gem/ruby/2.2.0/bin/glug:23:in `<main>'

File is converted succesfully if I remove the layer. I'm running ruby ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] but don't know enough ruby to debug.

@buma There seems to be a typo in
layer(:roads, :zoom=>10..13, :source=>osm_data) {
which should read
layer(:roads, :zoom=>10..13, :source=>:osm_data) {

Then it works for me.

It seems that there is really a type in example. It works with your change. Thanks.