Sha256: b412c0f8554ea21d7ac4ca1c563ead40c3d85b23d8d3008ae4dd6091a0350751

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

module Rails
  module SmartAppBanner
    module Helper
      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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smart-app-banner-0.0.2 lib/smart-app-banner/helper.rb