module TTY::Link

Constants

BEL
ESC
ITERM
OSC
SEP
VERSION

Public Class Methods

parse_version(version) click to toggle source

Parse version number

@param [String] version

@api private

# File lib/tty/link.rb, line 21
def parse_version(version)
  if (matches = version.match(/^(\d{1,2})(\d{2})$/))
    major, minor, patch = 0, matches[1].to_i, matches[2].to_i
  else
    major, minor, patch = version.split(".").map(&:to_i)
  end
  { major: major, minor: minor, patch: patch }
end

Private Instance Methods

parse_version(version) click to toggle source

Parse version number

@param [String] version

@api private

# File lib/tty/link.rb, line 21
def parse_version(version)
  if (matches = version.match(/^(\d{1,2})(\d{2})$/))
    major, minor, patch = 0, matches[1].to_i, matches[2].to_i
  else
    major, minor, patch = version.split(".").map(&:to_i)
  end
  { major: major, minor: minor, patch: patch }
end