This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Binding | |
| def return_if(name) | |
| eval "return #{name}" if local_variable_get(name) | |
| end | |
| end | |
| def foo(v) | |
| binding.return_if(:v) | |
| 'v is nil' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'ripper' | |
| require 'pp' | |
| def x(&blk) | |
| blk.call([1,2,3,4,5]) | |
| end | |
| code = 'x{|(x, *a, y)| p x; p a; p y }' | |
| eval code | |
| pp Ripper.sexp(code) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :grinning: 😀 | |
| :grin: 😁 | |
| :joy: 😂 | |
| :rofl: 🤣 | |
| :rolling_on_the_floor_laughing: 🤣 | |
| :smiley: 😃 | |
| :smile: 😄 | |
| :sweat_smile: 😅 | |
| :laughing: 😆 | |
| :satisfied: 😆 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| script/test | |
| ===> Bundling... | |
| Please export OCTOKIT_TEST_GITHUB_LOGIN | |
| Please export OCTOKIT_TEST_GITHUB_PASSWORD | |
| Please export OCTOKIT_TEST_GITHUB_TOKEN | |
| Please export OCTOKIT_TEST_GITHUB_CLIENT_ID | |
| Please export OCTOKIT_TEST_GITHUB_CLIENT_SECRET | |
| ===> Running specs... | |
| [DEPRECATION] `last_comment` is deprecated. Please use `last_description` instead. | |
| /usr/bin/ruby -I/home/pocke/.gem/ruby/2.4.0/gems/rspec-core-3.0.4/lib:/home/pocke/.gem/ruby/2.4.0/gems/rspec-support-3.0.4/lib -S /home/pocke/.gem/ruby/2.4.0/gems/rspec-core-3.0.4/exe/rspec ./spec/octokit/client/authorizations_spec.rb ./spec/octokit/client/commit_comments_spec.rb ./spec/octokit/client/commits_spec.rb ./spec/octokit/client/contents_spec.rb ./spec/octokit/client/deployments_spec.rb ./spec/octokit/client/downloads_spec.rb ./spec/octokit/client/emojis_spec.rb ./spec/octokit/client/events_spec.rb ./spec/octokit/client/feeds_spec.rb ./spec/octokit/client/gists_spec.rb ./spec/octokit/client/gitignore_spec.rb ./spec/octokit/client/hooks_spec.rb ./spec/octok |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NilClass | |
| def if | |
| self | |
| end | |
| def else | |
| yield self | |
| end | |
| end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def foo | |
| return 1 | |
| 42 | |
| # ^^ Lint/UnreachableCode: Unreachable code detected. | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/rubocop/cop/rails/blank.rb b/lib/rubocop/cop/rails/blank.rb | |
| index 119eed2b..ae2a8e36 100644 | |
| --- a/lib/rubocop/cop/rails/blank.rb | |
| +++ b/lib/rubocop/cop/rails/blank.rb | |
| @@ -52,8 +52,7 @@ module RuboCop | |
| (send $_ :!) | |
| (send $_ :nil?) | |
| (send $_ :== (:nil)) | |
| - (send nil $_) | |
| - (send (:nil) :== $_) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/rubocop/node_pattern.rb b/lib/rubocop/node_pattern.rb | |
| index 10da0350..9638590f 100644 | |
| --- a/lib/rubocop/node_pattern.rb | |
| +++ b/lib/rubocop/node_pattern.rb | |
| @@ -98,7 +98,7 @@ module RuboCop | |
| # @private | |
| # Builds Ruby code which implements a pattern | |
| class Compiler | |
| - SYMBOL = %r{:(?:[\w+@*/?!<>=~|%^-]+|\[\]=?)} | |
| + SYMBOL = %r{:(?:[\w+@*/?!<>=~|%^$-]+|\[\]=?)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Atasgn | |
| def atasgn(method_name) | |
| parameters = instance_method(method_name).parameters | |
| if parameters.any?{|type, _name| type == :opt || type == :key} | |
| raise 'Can not use a parameter with default value' | |
| end | |
| prepend(Module.new do | |
| eval <<~RUBY | |
| def #{method_name}(#{parameters.map do |type, name| |