Module: Ramaze::Helper::Link
- Defined in:
- lib/ramaze/helper/link.rb,
lib/ramaze/helper/gestalt.rb
Overview
This is a modification of Innate::Helper::Link to respect the routing of Ramaze
NOTE: The A/R/Rs methods have been deprecated.
Instance Method Summary collapse
-
#breadcrumbs(path, split = '/', join = '/', href_prefix = '') ⇒ String
Give it a path with character to split at and one to join the crumbs with.
- #route_location(klass) ⇒ Object
Instance Method Details
#breadcrumbs(path, split = '/', join = '/', href_prefix = '') ⇒ String
Give it a path with character to split at and one to join the crumbs with. It will generate a list of links that act as pointers to previous pages on this path.
Optionally a href prefix can be specified which generate link names a above, but with the prefix prepended to the href path.
46 47 48 49 50 51 52 53 54 |
# File 'lib/ramaze/helper/link.rb', line 46 def (path, split = '/', join = '/', href_prefix = '') atoms = path.split(split).reject{|a| a.empty?} crumbs = atoms.inject([]){|s,v| s << [s.last,v]} bread = crumbs.map do |a| href_path = href_prefix + a*'/' a(a[-1], href_path) end bread.join(join) end |