Skip to content

Commit 65c2bb1

Browse files
stomarmarcandre
authored andcommitted
Add Matrix::VERSION constant
Add Matrix::VERSION for the gem version, use it in the gemspec, and make it also available for library users.
1 parent 2bbb9be commit 65c2bb1

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lib/matrix.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
require "e2mmap"
1616

17+
require_relative "matrix/version"
18+
1719
module ExceptionForMatrix # :nodoc:
1820
extend Exception2MessageMapper
1921
def_e2message(TypeError, "wrong argument type %s (expected %s)")

lib/matrix/version.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# frozen_string_literal: true
2+
3+
class Matrix
4+
VERSION = "0.1.0"
5+
end

matrix.gemspec

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# frozen_string_literal: true
22

3+
begin
4+
require_relative "lib/matrix/version"
5+
rescue LoadError
6+
# for Ruby core repository
7+
require_relative "version"
8+
end
9+
310
Gem::Specification.new do |spec|
411
spec.name = "matrix"
5-
spec.version = "0.1.0"
12+
spec.version = Matrix::VERSION
613
spec.authors = ["Marc-Andre Lafortune"]
714
spec.email = ["ruby-core@marc-andre.ca"]
815

@@ -11,7 +18,7 @@ Gem::Specification.new do |spec|
1118
spec.homepage = "https://github.com/ruby/matrix"
1219
spec.license = "BSD-2-Clause"
1320

14-
spec.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "lib/matrix.rb", "lib/matrix/eigenvalue_decomposition.rb", "lib/matrix/lup_decomposition.rb", "matrix.gemspec"]
21+
spec.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "lib/matrix.rb", "lib/matrix/eigenvalue_decomposition.rb", "lib/matrix/lup_decomposition.rb", "lib/matrix/version.rb", "matrix.gemspec"]
1522
spec.bindir = "exe"
1623
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
1724
spec.require_paths = ["lib"]

0 commit comments

Comments
 (0)