Skip to content

Commit

Permalink
Narrow variable scope
Browse files Browse the repository at this point in the history
  • Loading branch information
dtan4 committed May 1, 2014
1 parent 22d4552 commit d9a704d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/md2pukiwiki.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require "md2pukiwiki/version"

module Md2pukiwiki
PREFIXED_TYPE = %w{header list numbered_list}
DECORATED_TYPE = %w{bold italic strikethrough}
SPECIAL_TYPE = %w{image link}

def self.convert(text)
prefixed_type = %w{header list numbered_list}
decorated_type = %w{bold italic strikethrough}
special_type = %w{image link}

text.lines.map do |line|
new_line = line.chomp

[PREFIXED_TYPE, DECORATED_TYPE, SPECIAL_TYPE].flatten.each do |type|
[prefixed_type, decorated_type, special_type].flatten.each do |type|
new_line = self.send("convert_#{type}", new_line)
end

Expand Down

0 comments on commit d9a704d

Please sign in to comment.