class ActiveSupport::CodeGenerator::MethodSet
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/active_support/code_generator.rbs class ActiveSupport::CodeGenerator::MethodSet def define_cached_method: (String name, as: String) -> untyped def initialize: (Symbol namespace) -> void end
:nodoc:
def apply(owner, path, line)
def apply(owner, path, line) unless @sources.empty? @cache.module_eval("# frozen_string_literal: true\n" + @sources.join(";"), path, line) end @methods.each do |name, as| owner.define_method(name, @cache.instance_method(as)) end end
def define_cached_method(name, as: name)
Experimental RBS support (using type sampling data from the type_fusion
project).
def define_cached_method: (String name, as: String) -> untyped
This signature was generated using 11 samples from 1 application.
def define_cached_method(name, as: name) name = name.to_sym as = as.to_sym @methods.fetch(name) do unless @cache.method_defined?(as) yield @sources end @methods[name] = as end end
def initialize(namespace)
Experimental RBS support (using type sampling data from the type_fusion
project).
def initialize: (Symbol namespace) -> void
This signature was generated using 1 sample from 1 application.
def initialize(namespace) @cache = METHOD_CACHES[namespace] @sources = [] @methods = {} end