Class: Itinerary::ConvertTool
- Inherits:
-
Tool
- Object
- Tool
- Itinerary::ConvertTool
show all
- Defined in:
- lib/itinerary/tools/convert.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Tool
find_tool, inherited, #initialize, tools
Class Method Details
.name ⇒ Object
4
5
6
|
# File 'lib/itinerary/tools/convert.rb', line 4
def self.name
'convert'
end
|
Instance Method Details
#parse(args) ⇒ Object
8
9
10
11
12
13
|
# File 'lib/itinerary/tools/convert.rb', line 8
def parse(args)
if args.first == '-n'
args.shift
@dry_run = true
end
end
|
#run ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/itinerary/tools/convert.rb', line 15
def run
@itinerary.each do |rec1|
rec2 = rec1.dup
if rec2.convert && rec2 != rec1
puts "#{rec2.path} changed in cleaning"
rec2.print_diff(rec1)
rec2.save! unless @dry_run
end
end
end
|