attr_required 1.0.0 → 1.0.2

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
- SHA1:
3
- metadata.gz: 4260a4fdd53e85325d7f3af498b0d887abc339a9
4
- data.tar.gz: 68a371629a1048d1de4eb5cd95719d1f728d17e8
2
+ SHA256:
3
+ metadata.gz: 17f71d6a11ee24db5db1ae4eacb88b6b92cd507a39171164b39e9e4ef33648f1
4
+ data.tar.gz: acb44f9e706328ff4f14c66aee7a9c05bbb74ca4e04a45e24ccb33b3dda5e18d
5
5
  SHA512:
6
- metadata.gz: 78fe3ea96f01939294f50b2c430346902a40e56be2603f7758ce4430b60fe4ae5cf39867e1600c7f06366655958646f8039967f0854b9761cdf8223b11b94d4c
7
- data.tar.gz: a8a9cbbac286d5ab5b38c9e89de1220c8bff2f900b2f2563524e1c986ed618236dd95ddbbf14f55453272d41ae82380b777a67cfe9d137d7cbafd597dd7539a4
6
+ metadata.gz: 7f59f5512ebcb5ba3bf22506b2989fba7bfd9ec499a09b7f35dc385edd495e5065132811b75ac3eedc60ecf4fa899236f2c73f8aa61e8f72fe06c60886b6ed8b
7
+ data.tar.gz: 22f8c5ae930db8bb5ed6375591e9ab3d2d18184dcc060194d1d07f099fcc0c26faf209edfd84b5a17c0500eabda4d2c6ab52a5da530540638fd4a46490a2f2d5
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: nov
@@ -0,0 +1,31 @@
1
+ name: Spec
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ spec:
14
+ strategy:
15
+ matrix:
16
+ os: ['ubuntu-20.04', 'ubuntu-22.04']
17
+ ruby-version: ['3.1', '3.2', '3.3']
18
+ include:
19
+ - os: 'ubuntu-20.04'
20
+ ruby-version: '3.0'
21
+ runs-on: ${{ matrix.os }}
22
+
23
+ steps:
24
+ - uses: actions/checkout@v3
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby-version }}
29
+ bundler-cache: true
30
+ - name: Run Specs
31
+ run: bundle exec rake spec
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
  gemspec
data/README.rdoc CHANGED
@@ -2,14 +2,12 @@
2
2
 
3
3
  This gem provide <code>attr_required</code> and <code>attr_optional</code> like <code>attr_accessor</code>.
4
4
 
5
- {<img src="https://secure.travis-ci.org/nov/attr_required.png" />}[http://travis-ci.org/nov/attr_required]
6
-
7
5
  REQUIRED and OPTIONAL are common terminology in RFCs, and used for protocol parameters.
8
6
  This gem helps RFC library developers to define which parameters (attributes in Ruby world) are REQUIRED and which are OPTIONAL.
9
7
  It might be also helpful for other developers.
10
8
 
11
9
  I've developed this gem to use for rack-oauth2, a Rack-based OAuth 2.0 library.
12
- http://github.com/nov/rack-oauth2
10
+ https://github.com/nov/rack-oauth2
13
11
 
14
12
  == Installation
15
13
 
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ namespace :coverage do
8
8
  desc "Open coverage report"
9
9
  task :report do
10
10
  require 'simplecov'
11
- `open "#{File.join SimpleCov.coverage_path, 'index.html' }"`
11
+ `open "#{File.join SimpleCov.coverage_path, 'index.html'}"`
12
12
  end
13
13
  end
14
14
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.2
@@ -1,20 +1,19 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = "attr_required"
3
- s.version = File.read("VERSION")
4
- s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
5
- s.authors = ["nov matake"]
2
+ s.name = 'attr_required'
3
+ s.version = File.read('VERSION')
4
+ s.authors = ['nov matake']
6
5
  s.description = %q{attr_required and attr_optional}
7
6
  s.summary = %q{attr_required and attr_optional}
8
- s.email = "nov@matake.jp"
9
- s.extra_rdoc_files = ["LICENSE", "README.rdoc"]
7
+ s.email = 'nov@matake.jp'
8
+ s.extra_rdoc_files = ['LICENSE', 'README.rdoc']
10
9
  s.license = 'MIT'
11
- s.rdoc_options = ["--charset=UTF-8"]
12
- s.homepage = "http://github.com/nov/attr_required"
13
- s.require_paths = ["lib"]
10
+ s.rdoc_options = ['--charset=UTF-8']
11
+ s.homepage = 'https://github.com/nov/attr_required'
12
+ s.require_paths = ['lib']
14
13
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
14
  s.files = `git ls-files`.split("\n")
16
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.add_development_dependency "rake", ">= 0.8"
18
- s.add_development_dependency "simplecov"
19
- s.add_development_dependency "rspec", ">= 2"
16
+ s.add_development_dependency 'rake'
17
+ s.add_development_dependency 'simplecov'
18
+ s.add_development_dependency 'rspec'
20
19
  end
data/lib/attr_optional.rb CHANGED
@@ -9,16 +9,16 @@ module AttrOptional
9
9
  def inherited(klass)
10
10
  super
11
11
  unless optional_attributes.empty?
12
- klass.attr_optional *optional_attributes
12
+ klass.attr_optional(*optional_attributes)
13
13
  end
14
14
  end
15
15
 
16
16
  def attr_optional(*keys)
17
17
  if defined? undef_required_attributes
18
- undef_required_attributes *keys
18
+ undef_required_attributes(*keys)
19
19
  end
20
20
  optional_attributes.concat(keys)
21
- attr_accessor *keys
21
+ attr_accessor(*keys)
22
22
  end
23
23
 
24
24
  def attr_optional?(key)
@@ -48,4 +48,4 @@ module AttrOptional
48
48
  self.class.attr_optional? key
49
49
  end
50
50
 
51
- end
51
+ end
data/lib/attr_required.rb CHANGED
@@ -11,16 +11,16 @@ module AttrRequired
11
11
  def inherited(klass)
12
12
  super
13
13
  unless required_attributes.empty?
14
- klass.attr_required *required_attributes
14
+ klass.attr_required(*required_attributes)
15
15
  end
16
16
  end
17
17
 
18
18
  def attr_required(*keys)
19
19
  if defined? undef_optional_attributes
20
- undef_optional_attributes *keys
20
+ undef_optional_attributes(*keys)
21
21
  end
22
22
  required_attributes.concat keys
23
- attr_accessor *keys
23
+ attr_accessor(*keys)
24
24
  end
25
25
 
26
26
  def attr_required?(key)
@@ -71,4 +71,4 @@ module AttrRequired
71
71
  end
72
72
  end
73
73
 
74
- end
74
+ end
@@ -1,4 +1,4 @@
1
- require 'spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  describe AttrOptional do
4
4
  before do
@@ -20,8 +20,8 @@ describe AttrOptional do
20
20
 
21
21
  context 'when already required' do
22
22
  it 'should be optional' do
23
- @c.attr_required?(:attr_required_b).should be_false
24
- @c.attr_optional?(:attr_required_b).should be_true
23
+ @c.attr_required?(:attr_required_b).should == false
24
+ @c.attr_optional?(:attr_required_b).should == true
25
25
  end
26
26
  end
27
27
 
@@ -34,19 +34,19 @@ describe AttrOptional do
34
34
 
35
35
  describe '.attr_optional?' do
36
36
  it 'should answer whether the attributes is optional or not' do
37
- A.attr_optional?(:attr_optional_a).should be_true
38
- B.attr_optional?(:attr_optional_a).should be_true
39
- B.attr_optional?(:attr_optional_b).should be_true
40
- B.attr_optional?(:to_s).should be_false
37
+ A.attr_optional?(:attr_optional_a).should == true
38
+ B.attr_optional?(:attr_optional_a).should == true
39
+ B.attr_optional?(:attr_optional_b).should == true
40
+ B.attr_optional?(:to_s).should == false
41
41
  end
42
42
  end
43
43
 
44
44
  describe '#attr_optional?' do
45
45
  it 'should answer whether the attributes is optional or not' do
46
- @a.attr_optional?(:attr_optional_a).should be_true
47
- @b.attr_optional?(:attr_optional_a).should be_true
48
- @b.attr_optional?(:attr_optional_b).should be_true
49
- @b.attr_optional?(:to_s).should be_false
46
+ @a.attr_optional?(:attr_optional_a).should == true
47
+ @b.attr_optional?(:attr_optional_a).should == true
48
+ @b.attr_optional?(:attr_optional_b).should == true
49
+ @b.attr_optional?(:to_s).should == false
50
50
  end
51
51
  end
52
52
 
@@ -1,4 +1,4 @@
1
- require 'spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  describe AttrRequired do
4
4
  before do
@@ -20,8 +20,8 @@ describe AttrRequired do
20
20
 
21
21
  context 'when already optional' do
22
22
  it 'should be optional' do
23
- @c.attr_required?(:attr_optional_b).should be_true
24
- @c.attr_optional?(:attr_optional_b).should be_false
23
+ @c.attr_required?(:attr_optional_b).should == true
24
+ @c.attr_optional?(:attr_optional_b).should == false
25
25
  end
26
26
  end
27
27
 
@@ -34,33 +34,33 @@ describe AttrRequired do
34
34
 
35
35
  describe '.attr_required?' do
36
36
  it 'should answer whether the attributes is required or not' do
37
- A.attr_required?(:attr_required_a).should be_true
38
- B.attr_required?(:attr_required_a).should be_true
39
- B.attr_required?(:attr_required_b).should be_true
40
- B.attr_required?(:to_s).should be_false
37
+ A.attr_required?(:attr_required_a).should == true
38
+ B.attr_required?(:attr_required_a).should == true
39
+ B.attr_required?(:attr_required_b).should == true
40
+ B.attr_required?(:to_s).should == false
41
41
  end
42
42
  end
43
43
 
44
44
  describe '#attr_required?' do
45
45
  it 'should answer whether the attributes is required or not' do
46
- @a.attr_required?(:attr_required_a).should be_true
47
- @b.attr_required?(:attr_required_a).should be_true
48
- @b.attr_required?(:attr_required_b).should be_true
49
- @a.attr_required?(:attr_required_b).should be_false
50
- @b.attr_required?(:to_s).should be_false
46
+ @a.attr_required?(:attr_required_a).should == true
47
+ @b.attr_required?(:attr_required_a).should == true
48
+ @b.attr_required?(:attr_required_b).should == true
49
+ @a.attr_required?(:attr_required_b).should == false
50
+ @b.attr_required?(:to_s).should == false
51
51
  end
52
52
  end
53
53
 
54
54
  describe '#attr_missing?' do
55
55
  it 'should answer whether any attributes are missing' do
56
- @a.attr_missing?.should be_true
57
- @b.attr_missing?.should be_true
56
+ @a.attr_missing?.should == true
57
+ @b.attr_missing?.should == true
58
58
  @a.attr_required_a = 'attr_required_a'
59
59
  @b.attr_required_a = 'attr_required_a'
60
- @a.attr_missing?.should be_false
61
- @b.attr_missing?.should be_true
60
+ @a.attr_missing?.should == false
61
+ @b.attr_missing?.should == true
62
62
  @b.attr_required_b = 'attr_required_b'
63
- @b.attr_missing?.should be_false
63
+ @b.attr_missing?.should == false
64
64
  end
65
65
  end
66
66
 
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,12 @@ SimpleCov.start do
4
4
  add_filter 'spec'
5
5
  end
6
6
 
7
+ RSpec.configure do |config|
8
+ config.expect_with :rspec do |c|
9
+ c.syntax = [:should, :expect]
10
+ end
11
+ end
12
+
7
13
  require 'attr_required'
8
14
  require 'attr_optional'
9
15
  require 'rspec'
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_required
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2023-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.8'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.8'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: simplecov
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '2'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '2'
54
+ version: '0'
55
55
  description: attr_required and attr_optional
56
56
  email: nov@matake.jp
57
57
  executables: []
@@ -60,9 +60,10 @@ extra_rdoc_files:
60
60
  - LICENSE
61
61
  - README.rdoc
62
62
  files:
63
- - .gitignore
64
- - .rspec
65
- - .travis.yml
63
+ - ".github/FUNDING.yml"
64
+ - ".github/workflows/spec.yml"
65
+ - ".gitignore"
66
+ - ".rspec"
66
67
  - Gemfile
67
68
  - LICENSE
68
69
  - README.rdoc
@@ -74,29 +75,28 @@ files:
74
75
  - spec/attr_optional_spec.rb
75
76
  - spec/attr_required_spec.rb
76
77
  - spec/spec_helper.rb
77
- homepage: http://github.com/nov/attr_required
78
+ homepage: https://github.com/nov/attr_required
78
79
  licenses:
79
80
  - MIT
80
81
  metadata: {}
81
- post_install_message:
82
+ post_install_message:
82
83
  rdoc_options:
83
- - --charset=UTF-8
84
+ - "--charset=UTF-8"
84
85
  require_paths:
85
86
  - lib
86
87
  required_ruby_version: !ruby/object:Gem::Requirement
87
88
  requirements:
88
- - - '>='
89
+ - - ">="
89
90
  - !ruby/object:Gem::Version
90
91
  version: '0'
91
92
  required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  requirements:
93
- - - '>='
94
+ - - ">="
94
95
  - !ruby/object:Gem::Version
95
- version: 1.3.6
96
+ version: '0'
96
97
  requirements: []
97
- rubyforge_project:
98
- rubygems_version: 2.0.3
99
- signing_key:
98
+ rubygems_version: 3.4.10
99
+ signing_key:
100
100
  specification_version: 4
101
101
  summary: attr_required and attr_optional
102
102
  test_files:
data/.travis.yml DELETED
@@ -1,3 +0,0 @@
1
- rvm:
2
- - 1.9.3
3
- - 2.0.0