ruby-changes:56405
From: Nobuyoshi <ko1@a...>
Date: Wed, 10 Jul 2019 01:31:32 +0900 (JST)
Subject: [ruby-changes:56405] Nobuyoshi Nakada: db844749af (master): Added StringIO::VERSION
https://git.ruby-lang.org/ruby.git/commit/?id=db844749af From db844749af2da9cc06d90db0cb317ec379582afa Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 10 Jul 2019 01:21:05 +0900 Subject: Added StringIO::VERSION diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 6ae9e80..4c135ef 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -11,6 +11,8 @@ https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L11 **********************************************************************/ +#define STRINGIO_VERSION "0.0.2" + #include "ruby.h" #include "ruby/io.h" #include "ruby/encoding.h" @@ -1629,6 +1631,8 @@ Init_stringio(void) https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L1631 #undef rb_intern VALUE StringIO = rb_define_class("StringIO", rb_cData); + rb_define_const(StringIO, "VERSION", rb_str_new_cstr(STRINGIO_VERSION)); + rb_include_module(StringIO, rb_mEnumerable); rb_define_alloc_func(StringIO, strio_s_allocate); rb_define_singleton_method(StringIO, "new", strio_s_new, -1); diff --git a/ext/stringio/stringio.gemspec b/ext/stringio/stringio.gemspec index df1d468..c0258ba 100644 --- a/ext/stringio/stringio.gemspec +++ b/ext/stringio/stringio.gemspec @@ -3,9 +3,18 @@ https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.gemspec#L3 # stub: stringio 0.0.0 ruby lib # stub: extconf.rb +source_version = ["", "ext/stringio/"].find do |dir| + begin + File.open(File.join(__dir__, "#{dir}stringio.c")) {|f| + f.gets("\n#define STRINGIO_VERSION ") + f.gets[/\s*(".+")/, 1].undump + } + rescue Errno::ENOENT + end +end Gem::Specification.new do |s| s.name = "stringio".freeze - s.version = "0.0.2" + s.version = source_version s.required_rubygems_version = Gem::Requirement.new(">= 2.6".freeze) s.require_paths = ["lib".freeze] -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/