Class: CopyMachine
- Inherits:
-
Object
- Object
- CopyMachine
- Extended by:
- TextUtils
- Defined in:
- lib/copy_machine.rb,
lib/copy_machine/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
Instance Method Summary collapse
- #copyright! ⇒ Object
- #copyright_file!(path) ⇒ Object
-
#initialize(target_path) ⇒ CopyMachine
constructor
A new instance of CopyMachine.
Methods included from TextUtils
Constructor Details
#initialize(target_path) ⇒ CopyMachine
Returns a new instance of CopyMachine.
19 20 21 |
# File 'lib/copy_machine.rb', line 19 def initialize(target_path) @target_path = target_path end |
Class Method Details
.MESSAGE ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/copy_machine.rb', line 8 def MESSAGE [ ('#' * 80), ('#' * 80), surround('Copyright (c) 2012 Multichannel Research Ltd. All rights reserved.', '#'), ('#' * 80), ('#' * 80) ].join("\n") + "\n" end |
Instance Method Details
#copyright! ⇒ Object
23 24 25 26 27 |
# File 'lib/copy_machine.rb', line 23 def copyright! Dir.glob("#{@target_path}/**/*.rb").each do |file| copyright_file!(file) end end |
#copyright_file!(path) ⇒ Object
29 30 31 32 33 |
# File 'lib/copy_machine.rb', line 29 def copyright_file!(path) @path = path new_output = CopyMachine.MESSAGE + file_contents write_results!(new_output) unless has_copyright? end |