[前][次][番号順一覧][スレッド一覧]

ruby-changes:59412

From: Marc-Andre <ko1@a...>
Date: Mon, 23 Dec 2019 20:08:08 +0900 (JST)
Subject: [ruby-changes:59412] 9be3295d53 (master): [ruby/ostruct] Create OpenStruct::VERSION

https://git.ruby-lang.org/ruby.git/commit/?id=9be3295d53

From 9be3295d53b6fd9f8a3ad8157aa0655b1976d8ac Mon Sep 17 00:00:00 2001
From: Marc-Andre Lafortune <github@m...>
Date: Sun, 22 Dec 2019 19:40:32 -0500
Subject: [ruby/ostruct] Create OpenStruct::VERSION


diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index 4d1f0ce..c40c897 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -72,6 +72,9 @@ https://github.com/ruby/ruby/blob/trunk/lib/ostruct.rb#L72
 # the objects that are created, as there is much more overhead in the setting
 # of these properties compared to using a Hash or a Struct.
 #
+
+require_relative 'ostruct/version'
+
 class OpenStruct
 
   #
diff --git a/lib/ostruct/ostruct.gemspec b/lib/ostruct/ostruct.gemspec
index 4faf5b8..4f85070 100644
--- a/lib/ostruct/ostruct.gemspec
+++ b/lib/ostruct/ostruct.gemspec
@@ -1,8 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/lib/ostruct/ostruct.gemspec#L1
 # frozen_string_literal: true
 
+begin
+  require_relative "lib/ostruct/version"
+rescue LoadError
+  # for Ruby core repository
+  require_relative "version"
+end
+
 Gem::Specification.new do |spec|
   spec.name          = "ostruct"
-  spec.version       = "0.1.0"
+  spec.version       = OpenStruct::VERSION
   spec.authors       = ["Marc-Andre Lafortune"]
   spec.email         = ["ruby-core@m..."]
 
@@ -11,7 +18,7 @@ Gem::Specification.new do |spec| https://github.com/ruby/ruby/blob/trunk/lib/ostruct/ostruct.gemspec#L18
   spec.homepage      = "https://github.com/ruby/ostruct"
   spec.license       = "BSD-2-Clause"
 
-  spec.files         = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "lib/ostruct.rb", "ostruct.gemspec"]
+  spec.files         = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "lib/ostruct.rb", "lib/ostruct/version.rb", "ostruct.gemspec"]
   spec.bindir        = "exe"
   spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
   spec.require_paths = ["lib"]
diff --git a/lib/ostruct/version.rb b/lib/ostruct/version.rb
new file mode 100644
index 0000000..4e26af9
--- /dev/null
+++ b/lib/ostruct/version.rb
@@ -0,0 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/ostruct/version.rb#L1
+# frozen_string_literal: true
+
+class OpenStruct
+  VERSION = "0.1.0"
+end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]