singleton 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69ce5ea038b9a035ac62e61824f08b9e6d806e26309f5666b6bdbd778baeb385
4
- data.tar.gz: 02e3504ffb6547ce784ccd4579f4b4e2cd0f0deddedc228f3c390bfee202240f
3
+ metadata.gz: e786d1a01bfbe5ea71091251637d5925cf0e65edbdb905c2bbec210a2f3217a9
4
+ data.tar.gz: de1b63e05881f81d14346c62c9de2518deca47ab66425ba38d1f112880b7524d
5
5
  SHA512:
6
- metadata.gz: 80e0df606115bfde6d963d4511664c1862d924dd3f6678a1368cd12290c144dc43ede2a62f3abd3bf8be294d9e72e99f0da42611aa9e0c9c298141acd426faf3
7
- data.tar.gz: e3a735efe724e487dc4f032c2b0f67a9fc1b2fd2840ff8c5840ffedd46c0889906e213a6946dc27f2bdcedab72e9067a1f188de55b003d8c34216781eca1318f
6
+ metadata.gz: 2b60779772a0727fd9eafdd0492a94002cc100ca0ff9e31f936828d82dee4b3c18ae62bad52a7b70df0355d47643d3ed7bdf89dd75bc751b341f1b18fc7a220f
7
+ data.tar.gz: e9db0abf5cf5b0d5c1520caca65e02077e72c837fc6a6d7de458420e6a8e68c1313eddd3085feeafba6b5359ee05dc729efae3b05a091fecdb53e7f0fd3d2c2b
@@ -0,0 +1,24 @@
1
+ name: test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
+ strategy:
9
+ matrix:
10
+ ruby: [ 2.7, 2.6, 2.5, 2.4, head ]
11
+ os: [ ubuntu-latest, macos-latest ]
12
+ runs-on: ${{ matrix.os }}
13
+ steps:
14
+ - uses: actions/checkout@master
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ - name: Install dependencies
20
+ run: |
21
+ gem install bundler --no-document
22
+ bundle install
23
+ - name: Run test
24
+ run: rake test
data/README.md CHANGED
@@ -32,7 +32,7 @@ end
32
32
  This ensures that only one instance of Klass can be created.
33
33
 
34
34
  ```ruby
35
- a,b = Klass.instance, Klass.instance
35
+ a,b = Klass.instance, Klass.instance
36
36
 
37
37
  a == b
38
38
  # => true
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # This ensures that only one instance of Klass can be created.
15
15
  #
16
- # a,b = Klass.instance, Klass.instance
16
+ # a,b = Klass.instance, Klass.instance
17
17
  #
18
18
  # a == b
19
19
  # # => true
@@ -58,10 +58,9 @@
58
58
  # == Singleton and Marshal
59
59
  #
60
60
  # By default Singleton's #_dump(depth) returns the empty string. Marshalling by
61
- # default will strip state information, e.g. instance variables and taint
62
- # state, from the instance. Classes using Singleton can provide custom
63
- # _load(str) and _dump(depth) methods to retain some of the previous state of
64
- # the instance.
61
+ # default will strip state information, e.g. instance variables from the instance.
62
+ # Classes using Singleton can provide custom _load(str) and _dump(depth) methods
63
+ # to retain some of the previous state of the instance.
65
64
  #
66
65
  # require 'singleton'
67
66
  #
@@ -82,7 +81,6 @@
82
81
  # a = Example.instance
83
82
  # a.keep = "keep this"
84
83
  # a.strip = "get rid of this"
85
- # a.taint
86
84
  #
87
85
  # stored_state = Marshal.dump(a)
88
86
  #
@@ -94,6 +92,8 @@
94
92
  # p a.strip # => nil
95
93
  #
96
94
  module Singleton
95
+ VERSION = "0.1.1"
96
+
97
97
  # Raises a TypeError to prevent cloning.
98
98
  def clone
99
99
  raise TypeError, "can't clone instance of singleton #{self.class}"
@@ -1,23 +1,28 @@
1
- lib = File.expand_path("lib", __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "singleton/version"
1
+ # frozen_string_literal: true
2
+
3
+ name = File.basename(__FILE__, ".gemspec")
4
+ version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
5
+ break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
6
+ /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
7
+ end rescue nil
8
+ end
4
9
 
5
10
  Gem::Specification.new do |spec|
6
- spec.name = "singleton"
7
- spec.version = Singleton::VERSION
11
+ spec.name = name
12
+ spec.version = version
8
13
  spec.authors = ["Yukihiro Matsumoto"]
9
14
  spec.email = ["matz@ruby-lang.org"]
10
15
 
11
16
  spec.summary = %q{The Singleton module implements the Singleton pattern.}
12
17
  spec.description = spec.summary
13
18
  spec.homepage = "https://github.com/ruby/singleton"
14
- spec.license = "BSD-2-Clause"
19
+ spec.licenses = ["Ruby", "BSD-2-Clause"]
15
20
 
16
21
  spec.metadata["homepage_uri"] = spec.homepage
17
22
  spec.metadata["source_code_uri"] = spec.homepage
18
23
 
19
24
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ `git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
26
  end
22
27
  spec.bindir = "exe"
23
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: singleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yukihiro Matsumoto
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-06 00:00:00.000000000 Z
11
+ date: 2020-12-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The Singleton module implements the Singleton pattern.
14
14
  email:
@@ -17,8 +17,8 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - ".github/workflows/test.yml"
20
21
  - ".gitignore"
21
- - ".travis.yml"
22
22
  - Gemfile
23
23
  - LICENSE.txt
24
24
  - README.md
@@ -26,15 +26,15 @@ files:
26
26
  - bin/console
27
27
  - bin/setup
28
28
  - lib/singleton.rb
29
- - lib/singleton/version.rb
30
29
  - singleton.gemspec
31
30
  homepage: https://github.com/ruby/singleton
32
31
  licenses:
32
+ - Ruby
33
33
  - BSD-2-Clause
34
34
  metadata:
35
35
  homepage_uri: https://github.com/ruby/singleton
36
36
  source_code_uri: https://github.com/ruby/singleton
37
- post_install_message:
37
+ post_install_message:
38
38
  rdoc_options: []
39
39
  require_paths:
40
40
  - lib
@@ -49,8 +49,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  requirements: []
52
- rubygems_version: 3.0.3
53
- signing_key:
52
+ rubygems_version: 3.2.2
53
+ signing_key:
54
54
  specification_version: 4
55
55
  summary: The Singleton module implements the Singleton pattern.
56
56
  test_files: []
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.3
7
- before_install: gem install bundler -v 2.0.2
@@ -1,3 +0,0 @@
1
- module Singleton
2
- VERSION = "0.1.0"
3
- end