Class: FeatureMap::CodeFeatures::Plugins::Identity

Inherits:
FeatureMap::CodeFeatures::Plugin show all
Defined in:
lib/feature_map/code_features/plugins/identity.rb

Defined Under Namespace

Classes: IdentityStruct

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FeatureMap::CodeFeatures::Plugin

all_plugins, bust_caches!, clear_feature_registry!, for, inherited, #initialize, missing_key_error_message

Constructor Details

This class inherits a constructor from FeatureMap::CodeFeatures::Plugin

Class Method Details

.validation_errors(features) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/feature_map/code_features/plugins/identity.rb', line 13

def self.validation_errors(features)
  errors = []

  uniq_set = Set.new
  features.each do |feature|
    for_feature = self.for(feature)

    if !uniq_set.add?(for_feature.identity.name)
      errors << "More than 1 definition for #{for_feature.identity.name} found"
    end

    errors << missing_key_error_message(feature, 'name') if for_feature.identity.name.nil?
  end

  errors
end

Instance Method Details

#identityObject



7
8
9
10
11
# File 'lib/feature_map/code_features/plugins/identity.rb', line 7

def identity
  IdentityStruct.new(
    @feature.raw_hash['name']
  )
end