module MagicLink::ViewHelpers
Public Instance Methods
magic_link_to(name = nil, options = nil, html_options = nil, &block)
click to toggle source
# File lib/magic_link/view_helpers.rb, line 3 def magic_link_to(name = nil, options = nil, html_options = nil, &block) if block_given? name = format_to_url(name) else options = format_to_url(options) end link_to(name, options, html_options, &block) end
magic_link_to_if(condition, name, options = {}, html_options = {}, &block)
click to toggle source
# File lib/magic_link/view_helpers.rb, line 12 def magic_link_to_if(condition, name, options = {}, html_options = {}, &block) if block_given? name = format_to_url(name) else options = format_to_url(options) end link_to_if(condition, name, options, html_options, &block) end
magic_link_to_unless(condition, name, options = {}, html_options = {}, &block)
click to toggle source
# File lib/magic_link/view_helpers.rb, line 22 def magic_link_to_unless(condition, name, options = {}, html_options = {}, &block) if block_given? name = format_to_url(name) else options = format_to_url(options) end link_to_unless(condition, name, options, html_options, &block) end
Private Instance Methods
format_to_url(smth)
click to toggle source
# File lib/magic_link/view_helpers.rb, line 33 def format_to_url(smth) if smth.is_a?(String) URL.new(smth).to_url else smth end end