Class: Xcflushd::GLIHelpers::PositiveMinMaxInt

Inherits:
Object
  • Object
show all
Defined in:
lib/xcflushd/gli_helpers.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(min, max) ⇒ PositiveMinMaxInt

Returns a new instance of PositiveMinMaxInt.



23
24
25
# File 'lib/xcflushd/gli_helpers.rb', line 23

def initialize(min, max)
  @min, @max = min, max
end

Instance Attribute Details

#maxObject (readonly)

Returns the value of attribute max.



21
22
23
# File 'lib/xcflushd/gli_helpers.rb', line 21

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



21
22
23
# File 'lib/xcflushd/gli_helpers.rb', line 21

def min
  @min
end

Class Method Details

.match(str) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/xcflushd/gli_helpers.rb', line 13

def self.match(str)
  md = POSITIVE_MIN_MAX_RE.match str
  return false if md.nil?
  min, max = [md[:min].to_i, md[:max].to_i]
  return false if max < min
  new min, max
end

Instance Method Details

#to_aObject



27
28
29
# File 'lib/xcflushd/gli_helpers.rb', line 27

def to_a
  [self]
end