Module: Glib::AppFeatureSupportHelper

Defined in:
app/helpers/glib/app_feature_support_helper.rb

Instance Method Summary collapse

Instance Method Details

#glib_app_feature_supported?(name, app_version, dictionary) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
# File 'app/helpers/glib/app_feature_support_helper.rb', line 3

def glib_app_feature_supported?(name, app_version, dictionary)
  device = (app_device_os || :default).to_sym

  version = dictionary[name.to_sym].try(:[], device)
  except = dictionary[name.to_sym].try(:[], :except).try(:[], device)

  !version.nil? && (version == :all || glib_app_version_gte(version, app_version)) && (except.nil? || except.to_s != app_version)
end

#glib_app_version_gte(feature_version, app_version) ⇒ Object



12
13
14
# File 'app/helpers/glib/app_feature_support_helper.rb', line 12

def glib_app_version_gte(feature_version, app_version)
  app_version.blank? || Gem::Version.new(app_version) >= Gem::Version.new(feature_version)
end