Class: AnnFlavorCore::AnnSpec

Inherits:
Struct
  • Object
show all
Defined in:
lib/vendor/ann_flavor_core/lib/ann_flavor_core/model.rb

Overview

── Top-level ───────────────────────────────────────────────────────────────

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



14
15
16
# File 'lib/vendor/ann_flavor_core/lib/ann_flavor_core/model.rb', line 14

def app
  @app
end

#debug_configObject

Returns the value of attribute debug_config

Returns:

  • (Object)

    the current value of debug_config



14
15
16
# File 'lib/vendor/ann_flavor_core/lib/ann_flavor_core/model.rb', line 14

def debug_config
  @debug_config
end

#enabledObject

Returns the value of attribute enabled

Returns:

  • (Object)

    the current value of enabled



14
15
16
# File 'lib/vendor/ann_flavor_core/lib/ann_flavor_core/model.rb', line 14

def enabled
  @enabled
end

#toolingObject

Returns the value of attribute tooling

Returns:

  • (Object)

    the current value of tooling



14
15
16
# File 'lib/vendor/ann_flavor_core/lib/ann_flavor_core/model.rb', line 14

def tooling
  @tooling
end

Class Method Details

.defaultsObject



15
# File 'lib/vendor/ann_flavor_core/lib/ann_flavor_core/model.rb', line 15

def self.defaults = new(app: AnnApp.new, enabled: true, debug_config: DebugConfig.new)

Instance Method Details

#flavor_exists_on?(platform_key, flavor_key) ⇒ Boolean

Whether flavor flavor_key has an entry under app.<platform_key>.flavor in the spec — i.e. whether this flavor actually targets that platform.

platform_key is 'android', 'ios', 'web', or 'windows' (any other value returns false). This says nothing about whether the platform itself is configured for the app at all — a platform absent from app entirely also returns false here, the same as a platform that exists but doesn't list this flavor. Callers that need to distinguish those two cases should check app.<platform_key>.nil? separately.

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
34
# File 'lib/vendor/ann_flavor_core/lib/ann_flavor_core/model.rb', line 26

def flavor_exists_on?(platform_key, flavor_key)
  platform = case platform_key
             when 'android' then app&.android
             when 'ios'     then app&.ios
             when 'web'     then app&.web
             when 'windows' then app&.windows
             end
  platform&.flavors&.key?(flavor_key) || false
end