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



7
8
9
10
11
# File 'lib/image_optim/non_negative_integer_range.rb', line 7

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