Sha256: 73f0ed2d378c5d5dcfd36cd6fe622e4091d7e94e3d00c870d9bb1faf551376b8

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 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 }\">"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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