Sha256: 91b6781af893c16c5c5e6b466e77a3d52124e581e9a86bf7f14c0b95b799f9ea
Contents?: true
Size: 1.46 KB
Versions: 23
Compression:
Stored size: 1.46 KB
Contents
= New Features * A link_to plugin has been added with a link_to method for creating HTML links. The simplest usage of link_to is passing the body and the location to link to as strings: # Instance level link_to("body", "/path") # => "<a href=\"/path\">body</a>" The link_to plugin depends on the path plugin, and allows you to pass symbols for named paths: # Class level path :foo, "/path/to/too" # Instance level link_to("body", :foo) # => "<a href=\"/path/to/foo\">body</a>" It also allows you to pass instances of classes that you have registered with the path plugin: # Class level A = Struct.new(:id) path A do "/path/to/a/#{id}" end # Instance level link_to("body", A.new(1)) # => "<a href=\"/path/to/a/1\">body</a>" To set additional HTML attributes on the tag, you can pass them as an options hash: link_to("body", "/path", foo: "bar") # => "<a href=\"/path\" foo=\"bar\">body</a>" If the body is nil, it will be set to the same as the path: link_to(nil, "/path") # => "<a href=\"/path\">/path</a>" The plugin will automatically HTML escape the path and any HTML attribute values, using the h plugin: link_to("body", "/path?a=1&b=2", foo: '"bar"') # => "<a href=\"/path?a=1&b=2\" foo=\""bar"\">body</a>" = Other Improvements * Coverage testing has been expanded to multiple rack versions, instead of just the current rack release.
Version data entries
23 entries across 23 versions & 1 rubygems