Class | Footnotes::Notes::ControllerNote |
In: |
lib/rails-footnotes/notes/controller_note.rb
|
Parent: | AbstractNote |
# File lib/rails-footnotes/notes/controller_note.rb, line 6 def initialize(controller) @controller = controller end
# File lib/rails-footnotes/notes/controller_note.rb, line 14 def link escape(Footnotes::Filter.prefix(controller_filename, controller_line_number + 1, 3)) end
# File lib/rails-footnotes/notes/controller_note.rb, line 33 def action_index (controller_text =~ /def\s+#{@controller.action_name}[\s\(]/) end
Some controller classes come with the Controller: | module and some don‘t |
(anyone know why? — Duane)
# File lib/rails-footnotes/notes/controller_note.rb, line 25 def controller_filename File.join(File.expand_path(RAILS_ROOT), 'app', 'controllers', "#{@controller.class.to_s.underscore}.rb").sub('/controllers/controllers/', '/controllers/') end
# File lib/rails-footnotes/notes/controller_note.rb, line 37 def controller_line_number lines_from_index(controller_text, action_index) || 0 end
# File lib/rails-footnotes/notes/controller_note.rb, line 29 def controller_text @controller_text ||= IO.read(controller_filename) end