diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/erb.gemspec | 9 | ||||
-rw-r--r-- | lib/erb.rb | 5 | ||||
-rw-r--r-- | lib/erb/version.rb | 5 |
3 files changed, 16 insertions, 3 deletions
diff --git a/lib/erb.gemspec b/lib/erb.gemspec index d310f40979..bb3f10f97d 100644 --- a/lib/erb.gemspec +++ b/lib/erb.gemspec @@ -1,6 +1,13 @@ +begin + require_relative 'lib/erb/version' +rescue LoadError + # for Ruby core repository + require_relative 'version' +end + Gem::Specification.new do |spec| spec.name = 'erb' - spec.version = '2.2.0' + spec.version = ERB.const_get(:VERSION, false) spec.authors = ['Masatoshi SEKI'] spec.email = ['seki@ruby-lang.org'] diff --git a/lib/erb.rb b/lib/erb.rb index f8533efda9..48e0505157 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -12,7 +12,8 @@ # # You can redistribute it and/or modify it under the same terms as Ruby. -require "cgi/util" +require 'cgi/util' +require 'erb/version' # # = ERB -- Ruby Templating @@ -260,7 +261,7 @@ class ERB # Returns revision information for the erb.rb module. def self.version - "erb.rb [2.2.0 #{ERB::Revision.split[1]}]" + "erb.rb [#{VERSION} #{ERB::Revision.split[1]}]" end end diff --git a/lib/erb/version.rb b/lib/erb/version.rb new file mode 100644 index 0000000000..83a88f3358 --- /dev/null +++ b/lib/erb/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: false +class ERB + VERSION = '2.2.0' + private_constant :VERSION +end |