Skip to content

Commit

Permalink
Use open with a block in Import::Tailoring#import.
Browse files Browse the repository at this point in the history
  • Loading branch information
KL-7 committed Jul 23, 2012
1 parent 45f5448 commit 41203ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/twitter_cldr/resources/import/tailoring.rb
Expand Up @@ -58,10 +58,10 @@ def import(locale)
print "Importing %8s\t--\t" % locale

if tailoring_present?(locale)
YAML.dump(tailoring_data(locale), open(resource_file_path(locale), 'w'))
dump(locale, tailoring_data(locale))
puts "Done."
else
YAML.dump(EMPTY_TAILORING_DATA, open(resource_file_path(locale), 'w'))
dump(locale, EMPTY_TAILORING_DATA)
puts "Missing (generated empty tailoring resource)."
end
rescue ImportError => e
Expand All @@ -70,6 +70,10 @@ def import(locale)

private

def dump(locale, data)
open(resource_file_path(locale), 'w') { |file| YAML.dump(data, file) }
end

def tailoring_present?(locale)
File.file?(locale_file_path(locale))
end
Expand Down

0 comments on commit 41203ab

Please sign in to comment.