Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various optimizations #3

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Style/NumericPredicate:
Style/Documentation:
Enabled: false

Layout/LineLength:
Exclude:
- lib/uri/idna/data/uts46.rb

Metrics:
Enabled: false

Expand Down
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ and this project adheres to [Semantic Versioning].

## [Unreleased]

### Changed

- Various performance and memory optimizations. ([@skryukov])

## [0.2.0] - 2023-11-14

### Added

- WHATWG IDNA functions
- WHATWG IDNA functions. ([@skryukov])

### Changed

- **BREAKING!** Names of options updated to match UTS46 flags
- Unicode version updated to 15.1
- UTS46 functions now support Revision 31
- **BREAKING!** Names of options updated to match UTS46 flags. ([@skryukov])
- Unicode version updated to 15.1. ([@skryukov])
- UTS46 functions now support Revision 31. ([@skryukov])

### Fixed

- IDNA2008 functions now support not only labels, but full domains
- IDNA2008 functions now support not only labels, but full domains. ([@skryukov])

## [0.1.0] - 2023-08-05

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ To specify Unicode version, use `VERSION` environment variable, e.g. `VERSION=15

By default, used Unicode version is the one used by the Ruby version (`RbConfig::CONFIG["UNICODE_VERSION"]`).

To set directory for generated files, use `DATA_DIR` environment variable, e.g. `DATA_DIR=lib/uri/idna/data bundle exec rake idna:generate`.
To set directory for generated files, use `DEST_DIR` environment variable, e.g. `DEST_DIR=lib/uri/idna/data bundle exec rake idna:generate`.

Unicode data cached in the `tmp` directory by default, to change it, use `CACHE_DIR` environment variable, e.g. `CACHE_DIR=~/.cache/unicode_data bundle exec rake idna:generate`.

Expand Down
6 changes: 6 additions & 0 deletions lib/uri/idna/base_processing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def split_domain(domain)

[labels, trailing_dot]
end

def check_bidi?
return @check_bidi if instance_variable_defined?(:@check_bidi)

@check_bidi = options.check_bidi? && Validation::Bidi.check?(domain_name)
end
end
end
end
Loading