Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Enable swedish characters åäö as valid constant names #543

Closed
wants to merge 1 commit into from

2 participants

@dentarg

I'm working on a project where the domain is in swedish and we want to use åäö in our class names.

What do you think about this? Is this fix reasonable? :)

@jeremyevans
Owner

I am rejecting this for the following reasons:

1) It does not make sense to attempt to solve this issue for only swedish characters. I'll only consider changes for m17n if support for all languages is included.

2) This does not work correctly on ruby 1.8, since AÅ is not a valid constant name in ruby 1.8. Sequel supports both ruby 1.8 and ruby 1.9 and any changes need to work on both.

3) Sequel's source files should not specify an encoding.

4) There are no specs included.

Note that you can work around your issue just by overwriting the constant (undefining it first if you want to avoid a warning), that's the path I recommend if you really want to use non-ASCII characters in your constant names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 30, 2012
  1. @dentarg
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/sequel/model/inflections.rb
View
4 lib/sequel/model/inflections.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
module Sequel
# Yield the Inflections module if a block is given, and return
# the Inflections module.
@@ -29,7 +31,7 @@ module Inflections
DEMODULIZE_CONVERT_REGEXP = /^.*::/.freeze
EMPTY_STRING= ''.freeze
SLASH = '/'.freeze
- VALID_CONSTANT_NAME_REGEXP = /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/.freeze
+ VALID_CONSTANT_NAME_REGEXP = /\A(?:::)?([A-Z][A-ZÅÄÖa-zåäö]*(?:::[A-Z][A-ZÅÄÖa-zåäö]*)*)\z/.freeze
UNDERSCORE = '_'.freeze
UNDERSCORE_CONVERT_REGEXP1 = /([A-Z]+)([A-Z][a-z])/.freeze
UNDERSCORE_CONVERT_REGEXP2 = /([a-z\d])([A-Z])/.freeze
Something went wrong with that request. Please try again.