diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:28:46 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:28:46 +0200 |
commit | e6ab70c439301d533f14b3387ee181d843a86b30 (patch) | |
tree | aec5e61d15660ff68ec99b8280b2f01f889127b1 /activesupport/bin/generate_tables | |
parent | adca8154c6ffce978a5dbc514273cceecbb15f8e (diff) | |
download | rails-e6ab70c439301d533f14b3387ee181d843a86b30.tar.gz rails-e6ab70c439301d533f14b3387ee181d843a86b30.tar.bz2 rails-e6ab70c439301d533f14b3387ee181d843a86b30.zip |
applies new string literal convention to the rest of the project
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
Diffstat (limited to 'activesupport/bin/generate_tables')
-rwxr-xr-x | activesupport/bin/generate_tables | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/activesupport/bin/generate_tables b/activesupport/bin/generate_tables index 2193533588..c5ed991d94 100755 --- a/activesupport/bin/generate_tables +++ b/activesupport/bin/generate_tables @@ -1,13 +1,13 @@ #!/usr/bin/env ruby begin - $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib')) - require 'active_support' + $:.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib")) + require "active_support" rescue IOError end -require 'open-uri' -require 'tmpdir' +require "open-uri" +require "tmpdir" module ActiveSupport module Multibyte @@ -20,10 +20,10 @@ module ActiveSupport class DatabaseGenerator BASE_URI = "http://www.unicode.org/Public/#{UNICODE_VERSION}/ucd/" SOURCES = { - :codepoints => BASE_URI + 'UnicodeData.txt', - :composition_exclusion => BASE_URI + 'CompositionExclusions.txt', - :grapheme_break_property => BASE_URI + 'auxiliary/GraphemeBreakProperty.txt', - :cp1252 => 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT' + :codepoints => BASE_URI + "UnicodeData.txt", + :composition_exclusion => BASE_URI + "CompositionExclusions.txt", + :grapheme_break_property => BASE_URI + "auxiliary/GraphemeBreakProperty.txt", + :cp1252 => "http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT" } def initialize @@ -52,9 +52,9 @@ module ActiveSupport codepoint.code = $1.hex codepoint.combining_class = Integer($4) codepoint.decomp_type = $7 - codepoint.decomp_mapping = ($8=='') ? nil : $8.split.collect(&:hex) - codepoint.uppercase_mapping = ($16=='') ? 0 : $16.hex - codepoint.lowercase_mapping = ($17=='') ? 0 : $17.hex + codepoint.decomp_mapping = ($8=="") ? nil : $8.split.collect(&:hex) + codepoint.uppercase_mapping = ($16=="") ? 0 : $16.hex + codepoint.lowercase_mapping = ($17=="") ? 0 : $17.hex @ucd.codepoints[codepoint.code] = codepoint end @@ -62,8 +62,8 @@ module ActiveSupport if line =~ /^([0-9A-F.]+)\s*;\s*([\w]+)\s*#/ type = $2.downcase.intern @ucd.boundary[type] ||= [] - if $1.include? '..' - parts = $1.split '..' + if $1.include? ".." + parts = $1.split ".." @ucd.boundary[type] << (parts[0].hex..parts[1].hex) else @ucd.boundary[type] << $1.hex @@ -105,7 +105,7 @@ module ActiveSupport filename = File.join(Dir.tmpdir, "#{url.split('/').last}") unless File.exist?(filename) $stderr.puts "Downloading #{url.split('/').last}" - File.open(filename, 'wb') do |target| + File.open(filename, "wb") do |target| open(url) do |source| source.each_line { |line| target.write line } end @@ -120,7 +120,7 @@ module ActiveSupport end def dump_to(filename) - File.open(filename, 'wb') do |f| + File.open(filename, "wb") do |f| f.write Marshal.dump([@ucd.codepoints, @ucd.composition_exclusion, @ucd.composition_map, @ucd.boundary, @ucd.cp1252]) end end |