Class: Unicode::Data::Generate
- Inherits:
-
Object
- Object
- Unicode::Data::Generate
- Defined in:
- lib/unicode/data/generate.rb
Defined Under Namespace
Classes: GeneralCategory, PropertyValueAliases
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#outfile ⇒ Object
readonly
Returns the value of attribute outfile.
-
#zipfile ⇒ Object
readonly
Returns the value of attribute zipfile.
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(zipfile, outfile, logger: Logger.new(STDOUT)) ⇒ Generate
constructor
A new instance of Generate.
Constructor Details
#initialize(zipfile, outfile, logger: Logger.new(STDOUT)) ⇒ Generate
Returns a new instance of Generate.
32 33 34 35 36 |
# File 'lib/unicode/data/generate.rb', line 32 def initialize(zipfile, outfile, logger: Logger.new(STDOUT)) @zipfile = zipfile @outfile = outfile @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
30 31 32 |
# File 'lib/unicode/data/generate.rb', line 30 def logger @logger end |
#outfile ⇒ Object (readonly)
Returns the value of attribute outfile.
30 31 32 |
# File 'lib/unicode/data/generate.rb', line 30 def outfile @outfile end |
#zipfile ⇒ Object (readonly)
Returns the value of attribute zipfile.
30 31 32 |
# File 'lib/unicode/data/generate.rb', line 30 def zipfile @zipfile end |
Class Method Details
.call ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/unicode/data/generate.rb', line 51 def self.call unicode_version = RbConfig::CONFIG["UNICODE_VERSION"] URI.open("https://www.unicode.org/Public/#{unicode_version}/ucd/UCD.zip") do |file| Zip::File.open_buffer(file) do |zipfile| File.open(File.join(__dir__, "derived.txt"), "w") do |outfile| new(zipfile, outfile).generate end end end end |
Instance Method Details
#generate ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/unicode/data/generate.rb', line 38 def generate property_aliases = read_property_aliases property_value_aliases = PropertyValueAliases.new(read_property_value_aliases) generate_general_categories generate_blocks(property_value_aliases) generate_ages(property_value_aliases) generate_scripts(property_value_aliases) generate_script_extensions(property_value_aliases) generate_core_properties(property_aliases, property_value_aliases) generate_prop_list_properties(property_aliases, property_value_aliases) end |