Class: FuzzyInfer::Registry

Inherits:
Hash
  • Object
show all
Includes:
Singleton
Defined in:
lib/fuzzy_infer/registry.rb

Class Method Summary collapse

Class Method Details

.config_for(class_name, targets) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fuzzy_infer/registry.rb', line 6

def config_for(class_name, targets)
  raise %{[fuzzy_infer] Zero machines are defined on #{class_name}.} unless instance.has_key?(class_name)
  unless k_v = instance[class_name].detect { |k, _| (targets & k) == targets }
    raise %{[fuzzy_infer] Target #{targets.inspect} is not available on #{class_name}.}
  end
  k_v.last
end