class ActiveSupport::CodeGenerator
:nodoc:
def batch(owner, path, line)
def batch(owner, path, line) if owner.is_a?(CodeGenerator) yield owner else instance = new(owner, path, line) result = yield instance instance.execute result end end
def define_cached_method(name, namespace:, as: name, &block)
def define_cached_method(name, namespace:, as: name, &block) @namespaces[namespace].define_cached_method(name, as: as, &block) end
def execute
def execute @namespaces.each_value do |method_set| method_set.apply(@owner, @path, @line - 1) end end
def initialize(owner, path, line)
def initialize(owner, path, line) @owner = owner @path = path @line = line @namespaces = Hash.new { |h, k| h[k] = MethodSet.new(k) } end