Class: Stick::Units::Regexps
- Inherits:
-
Object
- Object
- Stick::Units::Regexps
- Defined in:
- lib/stick/units/base.rb
Constant Summary collapse
- NUMBER_REGEXP =
/(\-?\d+((?:\.\d+)?(?:[eE][-+]?\d+)?))/
- SINGLE_UNIT_REGEXP =
/([a-zA-Z_]+)(?::([a-zA-Z_]+))?(?:\s*\*\*\s*([+-]?\d+))?/
- SINGLE_UNIT_NOC_REGEXP =
Violates DRY principle
/[a-zA-Z_]+(?::[a-zA-Z_]+)?(?:\s*\*\*\s*[+-]?\d+)?/
- MULTIPLE_UNIT_REGEXP =
/#{SINGLE_UNIT_NOC_REGEXP}(?:(?:\s+|\s*\*\s*)#{SINGLE_UNIT_NOC_REGEXP})*/
- TOTAL_UNIT_REGEXP =
/^\s*(?:1|(#{MULTIPLE_UNIT_REGEXP}))\s*(?:\/\s*(#{MULTIPLE_UNIT_REGEXP})\s*)?$/
- TOTAL_UNIT_NOC_REGEXP =
Violates DRY principle
/\s*(?:1|(?:#{MULTIPLE_UNIT_REGEXP}))\s*(?:\/\s*(?:#{MULTIPLE_UNIT_REGEXP})\s*)?/
- VALUE_REGEXP =
/^\s*#{NUMBER_REGEXP}\s*\*?\s*(#{TOTAL_UNIT_NOC_REGEXP})$/