interface 1.0.5 → 1.2.0

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.
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interface
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -35,10 +35,10 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date:
38
+ date: 2025-07-09 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
- name: test-unit
41
+ name: rake
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
@@ -52,19 +52,19 @@ dependencies:
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  - !ruby/object:Gem::Dependency
55
- name: rake
55
+ name: rspec
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0'
60
+ version: '3.9'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: '3.9'
68
68
  description: |2
69
69
  The interface library implements Java style interfaces for Ruby.
70
70
  It lets you define a set a methods that must be defined in the
@@ -72,38 +72,38 @@ description: |2
72
72
  email: djberg96@gmail.com
73
73
  executables: []
74
74
  extensions: []
75
- extra_rdoc_files:
76
- - README
77
- - CHANGES
78
- - MANIFEST
75
+ extra_rdoc_files: []
79
76
  files:
80
- - test
81
- - test/test_interface.rb
82
- - interface.gemspec
83
- - CHANGES
84
- - MANIFEST
85
- - README
77
+ - CHANGES.md
78
+ - Gemfile
79
+ - LICENSE
80
+ - MANIFEST.md
81
+ - README.md
86
82
  - Rakefile
87
- - certs
88
83
  - certs/djberg96_pub.pem
89
- - examples
84
+ - examples/enhanced_features_demo.rb
90
85
  - examples/example_instance.rb
91
86
  - examples/example_interface.rb
92
- - examples/example_unrequire.rb
93
87
  - examples/example_sub.rb
94
- - lib
88
+ - examples/example_unrequire.rb
89
+ - interface.gemspec
95
90
  - lib/interface.rb
91
+ - spec/interface_enhanced_spec.rb
92
+ - spec/interface_spec.rb
96
93
  homepage: http://github.com/djberg96/interface
97
94
  licenses:
98
95
  - Artistic-2.0
99
96
  metadata:
100
97
  homepage_uri: https://github.com/djberg96/interface
101
98
  bug_tracker_uri: https://github.com/djberg96/interface/issues
102
- changelog_uri: https://github.com/djberg96/interface/blob/master/CHANGES
99
+ changelog_uri: https://github.com/djberg96/interface/blob/main/CHANGES.md
103
100
  documentation_uri: https://github.com/djberg96/interface/wiki
104
101
  source_code_uri: https://github.com/djberg96/interface
105
102
  wiki_uri: https://github.com/djberg96/interface/wiki
106
- post_install_message:
103
+ rubygems_mfa_required: 'true'
104
+ github_repo: https://github.com/djberg96/interface
105
+ funding_uri: https://github.com/sponsors/djberg96
106
+ post_install_message:
107
107
  rdoc_options: []
108
108
  require_paths:
109
109
  - lib
@@ -118,9 +118,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.0.6
122
- signing_key:
121
+ rubygems_version: 3.5.22
122
+ signing_key:
123
123
  specification_version: 4
124
124
  summary: Java style interfaces for Ruby
125
125
  test_files:
126
- - test/test_interface.rb
126
+ - spec/interface_spec.rb
metadata.gz.sig CHANGED
Binary file
data/README DELETED
@@ -1,74 +0,0 @@
1
- == Description
2
- This module provides Java style interfaces for Ruby, including a fairly
3
- similar syntax. I don't necessarily believe in interfaces, but I wanted to
4
- put it out there as proof that it could be done. Frankly, Java needs mixins
5
- more than Ruby needs interfaces, but here you go.
6
-
7
- == Installation
8
- gem install interface
9
-
10
- == Synopsis
11
- require 'interface'
12
-
13
- MyInterface = interface{
14
- required_methods :foo, :bar, :baz
15
- }
16
-
17
- # Raises an error until 'baz' is defined
18
- class MyClass
19
- def foo
20
- puts "foo"
21
- end
22
-
23
- def bar
24
- puts "bar"
25
- end
26
-
27
- implements MyInterface
28
- end
29
-
30
- == General Notes
31
- Subinterfaces work as well. See the test_sub.rb file under the 'test'
32
- directory for a sample.
33
-
34
- == Developer's Notes
35
- A discussion on IRC with Mauricio Fernandez got us talking about traits.
36
- During that discussion I remembered a blog entry by David Naseby. I
37
- revisited his blog entry and took a closer look:
38
-
39
- http://ruby-naseby.blogspot.com/2008/11/traits-in-ruby.html
40
-
41
- Keep in mind that I also happened to be thinking about Java at the moment
42
- because of a recent job switch that involved coding in Java. I was also
43
- trying to figure out what the purpose of interfaces were.
44
-
45
- As I read the first page of David Naseby's article I realized that,
46
- whether intended or not, he had implemented a rudimentary form of interfaces
47
- for Ruby. When I discovered this, I talked about it some more with Mauricio
48
- and he and I (mostly him) fleshed out the rest of the module, including some
49
- syntax improvements. The result is syntax and functionality that is nearly
50
- identical to Java.
51
-
52
- I should note that, although I am listed as the author, this was mostly the
53
- combined work of David Naseby and Mauricio Fernandez. I just happened to be
54
- the guy that put it all together.
55
-
56
- == Acknowledgements
57
- This module was largely inspired and somewhat copied from a post by
58
- David Naseby (see URL above). It was subsequently modified almost entirely
59
- by Mauricio Fernandez through a series of discussions on IRC.
60
-
61
- == Copyright
62
- (C) 2004-2016 Daniel J. Berger
63
- All rights reserved.
64
-
65
- == Warranty
66
- This package is provided "as is" and without any express or
67
- implied warranties, including, without limitation, the implied
68
- warranties of merchantability and fitness for a particular purpose.
69
-
70
- == License
71
- Artistic 2.0
72
-
73
- == Author
74
- Daniel J. Berger
@@ -1,64 +0,0 @@
1
- #####################################################
2
- # test_interface.rb
3
- #
4
- # Test suite for the Interface module.
5
- #####################################################
6
- require 'test-unit'
7
- require 'interface'
8
-
9
- class TC_Interface < Test::Unit::TestCase
10
- def self.startup
11
- alpha_interface = interface{
12
- required_methods :alpha, :beta
13
- }
14
-
15
- gamma_interface = interface{
16
- extends alpha_interface
17
- required_methods :gamma
18
- unrequired_methods :alpha
19
- }
20
-
21
- # Workaround for 1.9.x
22
- @@alpha_interface = alpha_interface
23
- @@gamma_interface = gamma_interface
24
-
25
- eval("class A; end")
26
-
27
- eval("
28
- class B
29
- def alpha; end
30
- def beta; end
31
- end
32
- ")
33
-
34
- eval("
35
- class C
36
- def beta; end
37
- def gamma; end
38
- end
39
- ")
40
- end
41
-
42
- def test_version
43
- assert_equal('1.0.5', Interface::VERSION)
44
- assert_true(Interface::VERSION.frozen?)
45
- end
46
-
47
- def test_interface_requirements_not_met
48
- assert_raise(Interface::MethodMissing){ A.extend(@@alpha_interface) }
49
- assert_raise(Interface::MethodMissing){ A.new.extend(@@alpha_interface) }
50
- end
51
-
52
- def test_sub_interface_requirements_not_met
53
- assert_raise(Interface::MethodMissing){ B.extend(@@gamma_interface) }
54
- assert_raise(Interface::MethodMissing){ B.new.extend(@@gamma_interface) }
55
- end
56
-
57
- def test_alpha_interface_requirements_met
58
- assert_nothing_raised{ B.new.extend(@@alpha_interface) }
59
- end
60
-
61
- def test_gamma_interface_requirements_met
62
- assert_nothing_raised{ C.new.extend(@@gamma_interface) }
63
- end
64
- end