Class: AnnotateRb::RouteAnnotator::BaseProcessor
- Inherits:
-
Object
- Object
- AnnotateRb::RouteAnnotator::BaseProcessor
show all
- Defined in:
- lib/annotate_rb/route_annotator/base_processor.rb
Overview
This class is abstract class of classes adding and removing annotation to config/routes.rb.
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options, routes_file) ⇒ BaseProcessor
19
20
21
22
|
# File 'lib/annotate_rb/route_annotator/base_processor.rb', line 19
def initialize(options, routes_file)
@options = options
@routes_file = routes_file
end
|
Class Method Details
.execute(options, routes_file) ⇒ String
12
13
14
|
# File 'lib/annotate_rb/route_annotator/base_processor.rb', line 12
def execute(options, routes_file)
new(options, routes_file).execute
end
|
Instance Method Details
#routes_file_exist? ⇒ Boolean
38
39
40
|
# File 'lib/annotate_rb/route_annotator/base_processor.rb', line 38
def routes_file_exist?
File.exist?(routes_file)
end
|
#update ⇒ Boolean
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/annotate_rb/route_annotator/base_processor.rb', line 25
def update
if existing_text == new_text
false
else
if options[:frozen]
abort "AnnotateRb error. #{routes_file} needs to be updated, but annotaterb was run with `--frozen`."
end
write(new_text)
true
end
end
|