summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/securerandom.gemspec11
-rw-r--r--lib/securerandom.rb3
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/securerandom.gemspec b/lib/securerandom.gemspec
index e095244ce9..f42ddbcc97 100644
--- a/lib/securerandom.gemspec
+++ b/lib/securerandom.gemspec
@@ -1,6 +1,13 @@
+name = File.basename(__FILE__, ".gemspec")
+version = ["lib", Array.new(name.count("-")+1).join("/")].find do |dir|
+ break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
+ /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
+ end rescue nil
+end
+
Gem::Specification.new do |spec|
- spec.name = "securerandom"
- spec.version = "0.2.2"
+ spec.name = name
+ spec.version = version
spec.authors = ["Tanaka Akira"]
spec.email = ["akr@fsij.org"]
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index c5be6ce734..9faa09e4e0 100644
--- a/lib/securerandom.rb
+++ b/lib/securerandom.rb
@@ -39,6 +39,9 @@ require 'random/formatter'
# +NotImplementedError+ is raised.
module SecureRandom
+
+ VERSION = "0.2.2"
+
class << self
def bytes(n)
return gen_random(n)