Class: Super::Cheat

Inherits:
Object
  • Object
show all
Defined in:
lib/super/cheat.rb

Instance Method Summary collapse

Instance Method Details

#controllerObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/super/cheat.rb', line 5

def controller
  paths = %w[../../app/controllers/super/substructure_controller.rb]
  methods =
    paths
    .map { |f| File.read(File.expand_path(f, __dir__)) }
    .flat_map { |content| content.scan(/^\s+(?:helper_method )?def .*$/) }
    .map { |method| method.strip.sub(/^(?:helper_method )?def /, "#") }

  puts "== Super::ApplicationController"
  puts methods.join("\n")
end