Module: NavLinks::ViewHelpers

Defined in:
lib/nav_links/view_helpers.rb

Defined Under Namespace

Classes: NavLinksOptions

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
10
# File 'lib/nav_links/view_helpers.rb', line 3

def nav_link_to(*args, &block)
  title = block_given? ? capture(&block) : args.shift
  path         = args[0]
  html_options = args[1] || {}
  options      = args[2] || {}

  LinkGenerator.new(request, title, path, html_options, options).to_html
end

Yields:

  • (option_wrapper)

Raises:

  • (ArgumentError)


12
13
14
15
16
# File 'lib/nav_links/view_helpers.rb', line 12

def nav_links(options = {})
  raise ArgumentError, "Missing block" unless block_given?
  option_wrapper = NavLinksOptions.new(self, options)
  yield option_wrapper
end