ruby:
def a_unless_current
@page_current ? {tag: 'span'} : {tag: 'a', href: 'https://slim-template.github.io/'}
end
- @page_current = true
*a_unless_current Link
- @page_current = false
*a_unless_current Link
This example from the documentation does not seem to work.
It returns
t.slim:7:in `__tilt_620': undefined local variable or method `a_unless_current' for #<Object:0x000056c9e40ad598 @page_current=true> (NameError)
from /home/rein/.gem/ruby/3.0.0/gems/tilt-2.3.0/lib/tilt/template.rb:207:in `bind_call'
from /home/rein/.gem/ruby/3.0.0/gems/tilt-2.3.0/lib/tilt/template.rb:207:in `evaluate'
from /home/rein/.gem/ruby/3.0.0/gems/tilt-2.3.0/lib/tilt/template.rb:102:in `render'
from /home/rein/.gem/ruby/3.0.0/gems/slim-5.2.1/lib/slim/command.rb:104:in `process'
from /home/rein/.gem/ruby/3.0.0/gems/slim-5.2.1/lib/slim/command.rb:20:in `run'
from /home/rein/.gem/ruby/3.0.0/gems/slim-5.2.1/bin/slimrb:6:in `<top (required)>'
from /home/rein/.gem/ruby/3.0.0/bin/slimrb:25:in `load'
from /home/rein/.gem/ruby/3.0.0/bin/slimrb:25:in `<main>'
when executed with slimrb.
I haven't been able to call a method defined in a ruby: block at all so far.
This example from the documentation does not seem to work.
It returns
when executed with
slimrb
.I haven't been able to call a method defined in a
ruby:
block at all so far.