Class: VersionedBinary
- Inherits:
-
Object
- Object
- VersionedBinary
- Defined in:
- lib/ratatui_ruby/devtools/tasks/release/versioned_binary.rb
Overview
A compiled native extension binary for a specific Ruby version.
Class Method Summary collapse
-
.scan(lib_dir, gem_name = RatatuiRuby::Devtools.gem_name) ⇒ Object
Returns sorted VersionedBinary instances found under
lib_dir.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Sorts by API version so the binary list is in ascending Ruby order.
-
#api_version ⇒ Object
The major.minor API version used for Ruby version constraints.
-
#ruby_version ⇒ Object
The full Ruby version string extracted from the directory name.
Class Method Details
.scan(lib_dir, gem_name = RatatuiRuby::Devtools.gem_name) ⇒ Object
Returns sorted VersionedBinary instances found under lib_dir.
14 15 16 17 18 19 |
# File 'lib/ratatui_ruby/devtools/tasks/release/versioned_binary.rb', line 14 def self.scan(lib_dir, gem_name = RatatuiRuby::Devtools.gem_name) Dir.glob("#{lib_dir}/*/#{gem_name.tr('-', '_')}.*") .reject { |p| p.end_with?(".rb") } .map { |p| new(path: p) } .sort end |
Instance Method Details
#<=>(other) ⇒ Object
Sorts by API version so the binary list is in ascending Ruby order.
33 34 35 |
# File 'lib/ratatui_ruby/devtools/tasks/release/versioned_binary.rb', line 33 def <=>(other) api_version <=> other.api_version end |
#api_version ⇒ Object
The major.minor API version used for Ruby version constraints.
27 28 29 30 |
# File 'lib/ratatui_ruby/devtools/tasks/release/versioned_binary.rb', line 27 def api_version semver = SemVer.parse(ruby_version) "#{semver.major}.#{semver.minor}" end |
#ruby_version ⇒ Object
The full Ruby version string extracted from the directory name.
22 23 24 |
# File 'lib/ratatui_ruby/devtools/tasks/release/versioned_binary.rb', line 22 def ruby_version File.basename(File.dirname(path)) end |