Class: AnnotateRb::RouteAnnotator::Annotator

Inherits:
Object
  • Object
show all
Defined in:
lib/annotate_rb/route_annotator/annotator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Annotator

Returns a new instance of Annotator.



21
22
23
# File 'lib/annotate_rb/route_annotator/annotator.rb', line 21

def initialize(options = {})
  @options = options
end

Class Method Details

.add_annotations(options = {}) ⇒ Object



12
13
14
# File 'lib/annotate_rb/route_annotator/annotator.rb', line 12

def add_annotations(options = {})
  new(options).add_annotations
end

.do_annotations(options = {}) ⇒ Object

TODO: Deprecate



8
9
10
# File 'lib/annotate_rb/route_annotator/annotator.rb', line 8

def do_annotations(options = {})
  add_annotations(options)
end

.remove_annotations(options = {}) ⇒ Object



16
17
18
# File 'lib/annotate_rb/route_annotator/annotator.rb', line 16

def remove_annotations(options = {})
  new(options).remove_annotations
end

Instance Method Details

#add_annotationsObject



25
26
27
28
29
30
# File 'lib/annotate_rb/route_annotator/annotator.rb', line 25

def add_annotations
  routes_file = File.join("config", "routes.rb")
  AnnotationProcessor.execute(@options, routes_file).tap do |result|
    puts result
  end
end

#remove_annotationsObject



32
33
34
35
36
37
# File 'lib/annotate_rb/route_annotator/annotator.rb', line 32

def remove_annotations
  routes_file = File.join("config", "routes.rb")
  RemovalProcessor.execute(@options, routes_file).tap do |result|
    puts result
  end
end