Class: VersionBoss::Gem::VersionFileSources::Base
- Inherits:
-
Object
- Object
- VersionBoss::Gem::VersionFileSources::Base
- Defined in:
- lib/version_boss/gem/version_file_sources/base.rb
Overview
Base class for a version file source which implements #find
Class Method Summary collapse
-
.find ⇒ VersionBoss::Gem::VersionFile?
The first file from #glob whose content matches #content_regexp.
Class Method Details
.find ⇒ VersionBoss::Gem::VersionFile?
The first file from #glob whose content matches #content_regexp
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/version_boss/gem/version_file_sources/base.rb', line 20 def self.find # :nocov: JRuby does not mark the following line as covered Dir[glob].filter_map do |path| # :nocov: if (match = File.read(path).match(content_regexp)) version = VersionBoss::Gem::IncrementableVersion.new(match[:version]) VersionBoss::Gem::VersionFile.new(path, match[:content_before], version, match[:content_after]) end end.first end |