Module: NitroSg

Defined in:
lib/nitro_sg.rb,
lib/nitro_sg/engine.rb,
lib/nitro_sg/version.rb

Defined Under Namespace

Classes: Engine

Constant Summary collapse

VERSION =
"3.0.2".freeze

Class Method Summary collapse

Class Method Details

.assets_digestString

Returns the digest value for assets managed by the asset pipeline.

Returns:

  • (String)

    the digest value for assets managed by the asset pipeline



14
15
16
17
18
19
20
21
22
# File 'lib/nitro_sg.rb', line 14

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

.web_page_within_mobile_app?(request) ⇒ Boolean

Returns indication of whether the request is a web view within Nitro Mobile.

Returns:

  • (Boolean)

    indication of whether the request is a web view within Nitro Mobile



9
10
11
# File 'lib/nitro_sg.rb', line 9

def self.web_page_within_mobile_app?(request)
  request.user_agent.try(:downcase) =~ /^nitro/
end