Module: PlatformEndLine

Included in:
Formats
Defined in:
lib/subtitle_it/platform_endl.rb

Instance Method Summary collapse

Instance Method Details

#endline(raw) ⇒ Object



8
9
10
# File 'lib/subtitle_it/platform_endl.rb', line 8

def endline(raw)
  platform(raw) == 'WIN' ? "\r\n" : "\n"
end

#platform(raw) ⇒ Object



2
3
4
5
6
# File 'lib/subtitle_it/platform_endl.rb', line 2

def platform(raw)
  raw =~ /\r\n/ ? 'WIN' : 'UNIX'
rescue ArgumentError => e
  'WIN'
end