if Rails.env.production?
をやめて、if ENV['ENABLE_HOGEHOGE_FEATURE']
のように書いていこう
Rails.env
がたくさん生えています。
class C | |
def self.new: (String) -> untyped | |
end | |
class C2 < C | |
end | |
module M | |
def initialize: (String, Integer) -> void | |
end |
using Module.new { | |
refine ThreadGroup do | |
attr_accessor :fake_ractor | |
end | |
} | |
class FakeRactor | |
def initialize(*args, name: nil, &block) | |
@name = name | |
@incoming = Thread::Queue.new |
rules: | |
- id: sample.delete_all | |
pattern: | |
- delete_all | |
- update_all | |
message: | | |
これらはvalidationやcallbackをスキップするので危険かもしれません。 | |
justification: | |
- どうしても高速に update/destroy したい場合 |
module ActiveRecord | |
def self.eager_load!: () -> untyped | |
def self.gem_version: () -> untyped | |
def self.version: () -> untyped | |
end | |
class ActiveRecord::ActiveRecordError < StandardError | |
end |
# Devise | |
extension ApplicationController (Devise) | |
def current_user: () -> User | |
end | |
class DeviseController < ApplicationController | |
end | |
class Devise::SessionsController < DeviseController |
require 'net/http' | |
require 'json' | |
TEAM = ENV['TEAM'] or raise 'TEAM env is required' | |
TOKEN = ENV['KIBELA_ACCESS_TOKEN'] or raise 'KIBELA_ACCESS_TOKEN env is required' | |
def req(query) | |
http = Net::HTTP.new("#{TEAM}.kibe.la", 443) | |
http.use_ssl = true | |
header = { |
require 'ast' | |
require 'strscan' | |
class RuremaParser | |
def initialize(text, path: nil) | |
@text = text | |
@path = path | |
@index = 0 | |
end |
namespace :steep do | |
task gen: %i[base copy ar2rbs path_helper] | |
task :base do | |
require 'ruby/signature' | |
sig_base_path = Rails.root.join('sig/base.rbs') | |
files = Dir.glob(['app/**/*.rb', 'lib/**/*.rb']).sort | |
sh 'bundle', 'exec', 'rbs', 'prototype', 'rb', *files, :out => sig_base_path.to_s |
diff --git a/tmp/before.rbs b/tmp/after.rbs | |
index b67bb830f..49b9c3bdf 100644 | |
--- a/tmp/before.rbs | |
+++ b/tmp/after.rbs | |
@@ -271,7 +271,7 @@ class RuboCop::AST::CaseNode < Node | |
# Returns the keyword of the `case` statement as a string. | |
# | |
# @return [String] the keyword of the `case` statement | |
- def keyword: () -> untyped | |
+ def keyword: () -> "case" |