Class: Windows::Units::Recognizer::Formats::Percent

Inherits:
Base
  • Object
show all
Defined in:
lib/windows/units/recognizer.rb

Instance Attribute Summary

Attributes inherited from Base

#el, #unit

Instance Method Summary collapse

Methods inherited from Base

#format, #return_match

Instance Method Details

#matchObject

match 50px, 50PX, 50.5px, 50.1PX



36
37
38
39
40
41
# File 'lib/windows/units/recognizer.rb', line 36

def match
  return false unless el.respond_to?(:match)

  data  = el.match(/(^[\d.]+)(%)/i)
  return_match(self, data) { @unit = Float(data[1]) }
end