Class: CutCut::Helpers
- Inherits:
-
Object
- Object
- CutCut::Helpers
- Defined in:
- lib/cutcut/helpers.rb
Overview
Helpers
Class Method Summary collapse
Class Method Details
.copy_metadata(origin, target) ⇒ Object
15 16 17 18 |
# File 'lib/cutcut/helpers.rb', line 15 def self.(origin, target) exif = MiniExiftool.new(target.delete('\\')) exif.(origin.delete('\\'), '*') end |
.longest_common_substring(*strings) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/cutcut/helpers.rb', line 4 def self.longest_common_substring(*strings) short = strings.min_by(&:length) max = short.length max.downto(0) do |len| 0.upto(max - len) do |start| substr = short[start, len] return substr if strings.all? { |str| str.include? substr } end end end |