Skip to content

Commit

Permalink
use #lines over #to_a
Browse files Browse the repository at this point in the history
  • Loading branch information
nofxx committed Aug 30, 2015
1 parent 10df92c commit 145de37
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/subtitle_it/formats/mpl.rb
Expand Up @@ -8,7 +8,7 @@
module Formats
include PlatformEndLine
def parse_mpl
@raw.to_a.inject([]) do |i, l|
@raw.lines.inject([]) do |i, l|
line_data = l.scan(/^\[([0-9]{1,})\]\[([0-9]{1,})\](.+)$/)
line_data = line_data.at 0
time_on, time_off, text = line_data
Expand Down
2 changes: 1 addition & 1 deletion lib/subtitle_it/formats/rsb.rb
Expand Up @@ -11,7 +11,7 @@
module Formats
include PlatformEndLine
def parse_rsb
inn = @raw.to_a
inn = @raw.lines
@title = inn.delete_at(0).split(':')[1]
@authors = inn.delete_at(0).split(':')[1]
@version = inn.delete_at(0).split(':')[1]
Expand Down
3 changes: 1 addition & 2 deletions lib/subtitle_it/formats/sub.rb
Expand Up @@ -23,8 +23,7 @@ def ratio
end

def parse_sub
# FIXME: 1.8 and 1.9 way of working
@raw.send(@raw.respond_to?(:lines) ? :lines : :to_a).reduce([]) do |i, l|
@raw.lines.reduce([]) do |i, l|
line_data = l.scan(/^\{([0-9]{1,})\}\{([0-9]{1,})\}(.+)$/)
line_data = line_data.at 0
time_on, time_off, text = line_data
Expand Down

0 comments on commit 145de37

Please sign in to comment.