Module: Rails::SmartAppBanner::Helper

Defined in:
lib/smart-app-banner/helper.rb

Instance Method Summary collapse

Instance Method Details

#smart_app_banner(id, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/smart-app-banner/helper.rb', line 4

def smart_app_banner(id, options = {})
  unless id
    raise AppIDNotDefined
  end

  app_id = "app-id=#{ id }"

  if options[:affiliate_data].nil?
    affiliate_data = nil
  else
    affiliate_data = "affiliate-data=#{ options[:affiliate_data] }"
  end

  if options[:app_argument].nil?
    app_argument = nil
  else
    app_argument = "app-argument=#{ options[:app_argument] }"
  end

   = [app_id, affiliate_data, app_argument].
    delete_if(&:nil?).
    join(', ')

  output = "<meta name=\"apple-itunes-app\" content=\"#{  }\">".html_safe
end