Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andriikot/ruby-3.0-methods
Ruby 3.0 new syntax
https://github.com/andriikot/ruby-3.0-methods
Last synced: about 2 months ago
JSON representation
Ruby 3.0 new syntax
- Host: GitHub
- URL: https://github.com/andriikot/ruby-3.0-methods
- Owner: AndriiKot
- Created: 2023-03-29T16:06:14.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-03-29T16:44:47.000Z (over 1 year ago)
- Last Synced: 2024-01-09T00:29:28.060Z (12 months ago)
- Language: Ruby
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ruby-3.0-methods
Ruby 3.0 new syntax```ruby
def method1(...) = p(...)method1(1,2,[3,4],'string',:symbol,{a: 1,b: 2})
=begin
1
2
[3,4]
"string"
:sumbol
{:a => 1,:b => 2}
=enddef method2(method,arg1,arg2,*,**hash)
print "#{method.upcase} #{arg1} #{arg2} #{hash}"
enddef method3(...)
method2(:Symbol1, ...)
endmethod3(1,2,3,4,'string1','string2',[],c: 3,d: 4) # :SYMBOL 1 2 {:c => 3, :d => 4}
def method3(*args,**hash,&block)
[args,hash,block]
enddef method4(...)
method3(...)
endmethod4(1,2,3,a:1,b:2) { puts "Hello method 4" } # => [[1,2,3],{:a => 1,:b => 2}, #
```