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 PrivateBlock | |
def private(*args, &block) | |
return super unless block_given? | |
begin | |
methods = [] | |
mod = Module.new do | |
define_method :method_added do |name| | |
super(name).tap do | |
methods << name |
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/autoload/iro/ruby.vim.rb b/autoload/iro/ruby.vim.rb | |
index 9bb1d7b..a638d01 100644 | |
--- a/autoload/iro/ruby.vim.rb | |
+++ b/autoload/iro/ruby.vim.rb | |
@@ -11,6 +11,9 @@ module IroVim | |
source = Vim.evaluate("getbufline(#{bufnr}, 1, '$')").join("\n") | |
result = Iro::Ruby::Parser.tokens(source) | |
Vim.command 'let s:result = ' + JSON.generate(result) | |
+ rescue => ex | |
+ puts ex.backtrace |
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/imagemagick/trunk/PKGBUILD b/imagemagick/trunk/PKGBUILD | |
index 4c48742f627..38e36e4ac08 100644 | |
--- a/imagemagick/trunk/PKGBUILD | |
+++ b/imagemagick/trunk/PKGBUILD | |
@@ -1,9 +1,9 @@ | |
# $Id$ | |
# Maintainer: Eric Bélanger <[email protected]> | |
-pkgbase=imagemagick | |
-pkgname=('imagemagick' 'imagemagick-doc') |
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
#!/usr/bin/env ruby | |
require 'pathname' | |
require 'optparse' | |
$LOAD_PATH.unshift(Pathname(__dir__).join('../lib/').realpath) | |
require 'rubocop' | |
pattern, ruby, version = ARGV.options do |opt| | |
version = RUBY_VERSION |
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
# Requirements: ghq, hub | |
# Usage: ruby ghq_clone.rb YOUR_ACCOUNT_NAME | |
gem 'psych', '>= 3.0.1' | |
require 'octokit' | |
require 'psych' | |
require 'pathname' | |
def token | |
hub = Pathname(File.expand_path('~/.config/hub')) |
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 A | |
using(Module.new do | |
refine A do | |
def private_hello | |
puts 'Hello, real private method!' | |
end | |
end | |
end) | |
def public_hello |
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| |
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
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
def foo | |
return 1 | |
42 | |
# ^^ Lint/UnreachableCode: Unreachable code detected. | |
end |