Module: Tng::Services::ExtractMethods

Included in:
DirectGeneration
Defined in:
lib/tng/services/extract_methods.rb

Instance Method Summary collapse

Instance Method Details

#extract_controller_methods(controller) ⇒ Object



6
7
8
9
10
11
# File 'lib/tng/services/extract_methods.rb', line 6

def extract_controller_methods(controller)
  Tng::Analyzers::Controller.methods_for_controller(controller[:name]) || []
rescue StandardError => e
  puts center_text(@pastel.decorate("#{Tng::UI::Theme.icon(:error)} Error analyzing controller: #{e.message}", Tng::UI::Theme.color(:error)))
  []
end

#extract_model_methods(model) ⇒ Object



13
14
15
16
17
18
# File 'lib/tng/services/extract_methods.rb', line 13

def extract_model_methods(model)
  Tng::Analyzers::Model.methods_for_model(model[:name]) || []
rescue StandardError => e
  puts center_text(@pastel.decorate("#{Tng::UI::Theme.icon(:error)} Error analyzing model: #{e.message}", Tng::UI::Theme.color(:error)))
  []
end

#extract_other_methods(other_file) ⇒ Object



27
28
29
30
31
32
# File 'lib/tng/services/extract_methods.rb', line 27

def extract_other_methods(other_file)
  Tng::Analyzers::Other.methods_for_other(other_file[:name], other_file[:path]) || []
rescue StandardError => e
  puts center_text(@pastel.decorate("#{Tng::UI::Theme.icon(:error)} Error analyzing file: #{e.message}", Tng::UI::Theme.color(:error)))
  []
end

#extract_service_methods(service) ⇒ Object



20
21
22
23
24
25
# File 'lib/tng/services/extract_methods.rb', line 20

def extract_service_methods(service)
  Tng::Analyzers::Service.methods_for_service(service[:name]) || []
rescue StandardError => e
  puts center_text(@pastel.decorate("#{Tng::UI::Theme.icon(:error)} Error analyzing service: #{e.message}", Tng::UI::Theme.color(:error)))
  []
end