Class: WhiskeyDisk::Config::EnvironmentScopeFilter

Inherits:
AbstractFilter show all
Includes:
ScopeHelper
Defined in:
lib/whiskey_disk/config/filters/environment_scope_filter.rb

Instance Attribute Summary

Attributes inherited from AbstractFilter

#config

Instance Method Summary collapse

Methods included from ScopeHelper

#repository_depth

Methods inherited from AbstractFilter

#environment_name, #initialize, #project_name

Constructor Details

This class inherits a constructor from WhiskeyDisk::Config::AbstractFilter

Instance Method Details

#filter(data) ⇒ Object



14
15
16
17
# File 'lib/whiskey_disk/config/filters/environment_scope_filter.rb', line 14

def filter(data)
  return data unless needs_environment_scoping?(data)
  { environment_name => data }
end

#needs_environment_scoping?(data) ⇒ Boolean

is this data hash a bottom-level data hash without an environment name?

Returns:

  • (Boolean)


10
11
12
# File 'lib/whiskey_disk/config/filters/environment_scope_filter.rb', line 10

def needs_environment_scoping?(data)
  repository_depth(data) == 0
end