Class: Windows::Units::Recognizer::Finder

Inherits:
Struct
  • Object
show all
Includes:
Formats
Defined in:
lib/windows/units/recognizer.rb

Constant Summary

Constants included from Formats

Windows::Units::Recognizer::Formats::RECOGNIZERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#elObject

Returns the value of attribute el

Returns:

  • (Object)

    the current value of el



47
48
49
# File 'lib/windows/units/recognizer.rb', line 47

def el
  @el
end

Instance Method Details

#runObject



50
51
52
53
54
55
56
57
58
# File 'lib/windows/units/recognizer.rb', line 50

def run
  item = RECOGNIZERS.map do |klass|
    recognizer = klass.new(el)
    recognizer.match
  end.compact.first

  raise "I don't know how to recognize this unit #{el}" unless item
  item
end