Method: Ore::Versions::VersionConstant.extract_version

Defined in:
lib/ore/versions/version_constant.rb

.extract_version(line) ⇒ String? (protected)

Extracts the version string from a VERSION constant declaration.

Parameters:

  • line (String)

    The line of Ruby code where the VERSION constant was defined.

Returns:

  • (String, nil)

    The extracted version string.



87
88
89
90
91
# File 'lib/ore/versions/version_constant.rb', line 87

def self.extract_version(line)
  if (match = line.match(/=\s*['"](\d+\.\d+\.\d+(\.\w+)?)['"]/))
    match[1]
  end
end