Class: SiSU_i18n::Alphabet

Inherits:
Object
  • Object
show all
Defined in:
lib/sisu/i18n.rb

Instance Method Summary collapse

Constructor Details

#initialize(lng_code) ⇒ Alphabet

Returns a new instance of Alphabet.



195
196
197
# File 'lib/sisu/i18n.rb', line 195

def initialize(lng_code)
  @lng_code=lng_code
end

Instance Method Details

#hash_arraysObject



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/sisu/i18n.rb', line 198

def hash_arrays
  @alph=case @lng_code
  when /en/                                                              #english
    {
      u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z],
      l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]
    }
  when /da|no|nn/                                                        #danish, norwegian
    {
      u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Æ Ø],
      l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z å æ ø]
      #u: %W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Æ Ø Å],
      #l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z æ ø å]
    }
  when /sv/                                                              #swedish
    {
      u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Ä Ö],
      l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z å ä ö]
    }
  else                                                                   #english default
    {
      u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z],
      l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]
    }
  end
end

#hash_stringsObject



224
225
226
# File 'lib/sisu/i18n.rb', line 224

def hash_strings
  { u: hash_arrays[:u].join, l: hash_arrays[:l].join }
end