Skip to content

Commit b879d6e

Browse files
committed
Added the toplevel method
1 parent 33787f3 commit b879d6e

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Or install it yourself as:
2121

2222
## Usage
2323

24+
For class/module instance methods:
25+
2426
```ruby
2527
require 'ruby2_keywords'
2628

@@ -30,6 +32,15 @@ module YourModule
3032
end
3133
```
3234

35+
For global methods:
36+
37+
```ruby
38+
require 'ruby2_keywords'
39+
40+
ruby2_keywords def oldstyle_keywords(options = {})
41+
end
42+
```
43+
3344
## Contributing
3445

3546
Bug reports and pull requests are welcome on GitHub at https://bugs.ruby-lang.org.

lib/ruby2_keywords.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ def ruby2_keywords(*)
66
end
77
end
88
end
9+
10+
main = TOPLEVEL_BINDING.receiver
11+
unless main.respond_to?(:ruby2_keywords, true)
12+
def main.ruby2_keywords(*)
13+
# nil
14+
end
15+
end

ruby2_keywords.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "0.0.0"
1+
version = "0.0.1"
22

33
Gem::Specification.new do |s|
44
s.name = "ruby2_keywords"

0 commit comments

Comments
 (0)