Another option is to create a generic helper:

  def wrap_with_li_if(condition, content = nil, &block)
    if block_given?
      content = capture(&block)
    end    
    return content_tag(:li, content) if condition
    return content
  end

Then you can use it like so:

  = wrap_with_li_if(defined?(skipLI) && skipLI) do
    %span This is not DRY

or

  - notDRY = "This is not DRY"
    = wrap_with_li_if(defined?(skipLI) && skipLI, notDRY)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/a4nJLzovFnQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to