Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Sinatra adapter no longer renders attributes with nil values as attri…

…butes with empty strings in the output, instead \

electing not to render the attribute at all. Fixes issue #93. Thanks to @revdan for pointing this out.
  • Loading branch information...
commit c956410b616641f59b2f0c26d540ef3445ea8706 1 parent 73b997a
@mjtko mjtko authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/simple_navigation/adapters/sinatra.rb
View
6 lib/simple_navigation/adapters/sinatra.rb
@@ -43,11 +43,11 @@ def current_page?(url)
end
def link_to(name, url, options={})
- "<a href='#{url}' #{to_attributes(options)}>#{name}</a>"
+ "<a href='#{url}'#{to_attributes(options)}>#{name}</a>"
end
def content_tag(type, content, options={})
- "<#{type} #{to_attributes(options)}>#{content}</#{type}>"
+ "<#{type}#{to_attributes(options)}>#{content}</#{type}>"
end
protected
@@ -61,7 +61,7 @@ def self.sinatra_environment
end
def to_attributes(options)
- options.map {|k, v| "#{k}='#{v}'"}.join(' ')
+ options.map {|k, v| v.nil? ? '' : " #{k}='#{v}'"}.join
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.