Class: ImageOptim::NonNegativeIntegerRange

Inherits:
Object
  • Object
show all
Defined in:
lib/image_optim/non_negative_integer_range.rb

Overview

Denote range of non negative integers for worker option

Class Method Summary collapse

Class Method Details

.add_to_option_parser(option_parser) ⇒ Object

Add handling of range of non negative integers in OptionParser instance


5
6
7
8
9
# File 'lib/image_optim/non_negative_integer_range.rb', line 5

def self.add_to_option_parser(option_parser)
  option_parser.accept(self, /(\d+)(?:-|\.\.)(\d+)/) do |_, m, n|
    m.to_i..n.to_i
  end
end