Sha256: 0762b5ffb9a2a78f84b8c9184c3594aaeb5007908e8446f8814e21c4cef7d6cd

Contents?: true

Size: 731 Bytes

Versions: 3

Compression:

Stored size: 731 Bytes

Contents

require "sassc-rails"

require "nitro_sg/engine"



module NitroSg
  # @return [Boolean] indication of whether the request is a web view within Nitro Mobile
  def self.web_page_within_mobile_app?(request)
    request.user_agent.try(:downcase) =~ /^nitro/
  end

  # @return [String] the digest value for assets managed by the asset pipeline
  def self.assets_digest
    @assets_digest ||= begin
      if ActionView::Base.respond_to?(:asset_manifest) # Rails 4
        Digest::MD5.hexdigest(ActionView::Base.assets_manifest.assets.values.sort.join)
      elsif Rails.configuration.assets.digests.present? # Rails 3
        Digest::MD5.hexdigest(Rails.configuration.assets.digests.try(:values).sort.join)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nitro_sg-3.0.2 lib/nitro_sg.rb
nitro_sg-3.0.1 lib/nitro_sg.rb
nitro_sg-3.0.0 lib/nitro_sg.rb