This file contains 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 | |
# frozen_string_literal: true | |
# Phase to load libraries | |
require_relative "../config/application" | |
require 'orthoses/rails' | |
require 'orthoses/yard' | |
# You can choose logger level | |
Orthoses.logger.level = :warn |
This file contains 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
version: 2.1 | |
# this allows you to use CircleCI's dynamic configuration feature | |
setup: true | |
parameters: | |
tree_sha_path: | |
type: string | |
default: ".git_tree_sha" | |
tree_status_path: |
This file contains 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
# frozen_string_literal: true | |
require 'sidekiq/logger' | |
module App | |
module Formatters | |
class Sidekiq < ::Sidekiq::Logger::Formatters::Pretty | |
def call(severity, time, _program_name, message) | |
hash = { | |
timestamp: time.utc.iso8601(3), |
This file contains 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 | |
# frozen_string_literal: true | |
# Rails v7.0.5以降におけるcreate_associationメソッドの影響範囲を調べるスクリプト | |
# | |
# ## 参考ページ | |
# * Rails 7.0.5以降におけるcreate_associationメソッドの挙動変更についてまとめ | |
# https://blog.willnet.in/entry/2023/07/04/113321 | |
# * parser gemでRubyプログラムのバグを探す | |
# https://nacl-ltd.github.io/2021/07/02/ruby-ast.html |
This file contains 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
# frozen_string_literal: true | |
# This is a test script for create_association incompatibility. | |
# | |
# usage | |
# * `RAILS_VERSION=7.0.4 ruby active_record_test.rb` | |
# * `RAILS_VERSION=7.0.5 ruby active_record_test.rb` | |
# | |
# see also | |
# * https://github.com/rails/rails/issues/48330 |
This file contains 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 | |
@@foo = "foo" | |
class << self | |
@@bar = "bar" | |
end | |
end | |
p A.class_variable_get(:@@foo) #=> "foo" | |
p A.class_variable_get(:@@bar) #=> "bar" |
This file contains 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 A; end | |
module B; end | |
module C; end | |
class Foo | |
include A | |
include B | |
include C | |
end |
This file contains 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 As | |
class Proxy | |
def initialize(this, mod) | |
@this = this | |
@mod = mod | |
end | |
def method_missing(name, *args) | |
raise NoMethodError unless @mod.instance_methods.include?(name) | |
@mod.instance_method(name).bind_call(@this, *args) |
This file contains 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
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
# Activate the gem you are reporting the issue against. |
This file contains 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 ApplicationController < ActionController::Base | |
class << self | |
[:before, :after, :around].each do |callback| | |
define_method "#{callback}_action" do |*names, &blk| | |
options = names.extract_options! | |
new_blk = -> { | |
# 本来の処理の前に行う処理を書く。 | |
if blk.is_a?(Proc) | |
blk.call |
NewerOlder