faker 1.8.7 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +146 -6
  3. data/README.md +44 -4
  4. data/lib/extensions/array.rb +10 -10
  5. data/lib/extensions/symbol.rb +0 -1
  6. data/lib/faker.rb +42 -35
  7. data/lib/faker/address.rb +39 -13
  8. data/lib/faker/app.rb +1 -3
  9. data/lib/faker/appliance.rb +13 -0
  10. data/lib/faker/avatar.rb +2 -2
  11. data/lib/faker/bank.rb +72 -15
  12. data/lib/faker/beer.rb +0 -1
  13. data/lib/faker/bitcoin.rb +4 -5
  14. data/lib/faker/bojack_horseman.rb +17 -0
  15. data/lib/faker/breaking_bad.rb +0 -3
  16. data/lib/faker/business.rb +1 -2
  17. data/lib/faker/cannabis.rb +42 -0
  18. data/lib/faker/chuck_norris.rb +3 -2
  19. data/lib/faker/code.rb +59 -20
  20. data/lib/faker/coffee.rb +4 -0
  21. data/lib/faker/color.rb +2 -2
  22. data/lib/faker/commerce.rb +3 -4
  23. data/lib/faker/community.rb +13 -0
  24. data/lib/faker/company.rb +80 -24
  25. data/lib/faker/currency.rb +17 -0
  26. data/lib/faker/date.rb +13 -27
  27. data/lib/faker/demographic.rb +2 -2
  28. data/lib/faker/device.rb +29 -0
  29. data/lib/faker/dota.rb +25 -0
  30. data/lib/faker/dr_who.rb +7 -8
  31. data/lib/faker/dumb_and_dumber.rb +1 -1
  32. data/lib/faker/dune.rb +4 -4
  33. data/lib/faker/elder_scrolls.rb +16 -0
  34. data/lib/faker/electrical_components.rb +19 -0
  35. data/lib/faker/ethereum.rb +12 -0
  36. data/lib/faker/famous_last_words.rb +11 -0
  37. data/lib/faker/file.rb +2 -5
  38. data/lib/faker/fillmurray.rb +3 -4
  39. data/lib/faker/finance.rb +3 -4
  40. data/lib/faker/food.rb +21 -1
  41. data/lib/faker/football.rb +21 -0
  42. data/lib/faker/gender.rb +13 -0
  43. data/lib/faker/greek_philosophers.rb +13 -0
  44. data/lib/faker/hacker.rb +9 -11
  45. data/lib/faker/harry_potter.rb +4 -0
  46. data/lib/faker/hipster.rb +12 -4
  47. data/lib/faker/id_number.rb +24 -9
  48. data/lib/faker/internet.rb +69 -57
  49. data/lib/faker/invoice.rb +94 -0
  50. data/lib/faker/job.rb +10 -3
  51. data/lib/faker/lebowski.rb +2 -2
  52. data/lib/faker/lord_of_the_rings.rb +5 -1
  53. data/lib/faker/lorem.rb +32 -8
  54. data/lib/faker/lorem_flickr.rb +43 -0
  55. data/lib/faker/lorem_pixel.rb +20 -5
  56. data/lib/faker/lovecraft.rb +12 -5
  57. data/lib/faker/markdown.rb +12 -4
  58. data/lib/faker/measurement.rb +35 -80
  59. data/lib/faker/michael_scott.rb +9 -0
  60. data/lib/faker/military.rb +25 -0
  61. data/lib/faker/music.rb +13 -1
  62. data/lib/faker/myst.rb +25 -0
  63. data/lib/faker/name.rb +22 -8
  64. data/lib/faker/nation.rb +24 -0
  65. data/lib/faker/nato_phonetic_alphabet.rb +9 -0
  66. data/lib/faker/new_girl.rb +13 -0
  67. data/lib/faker/number.rb +12 -12
  68. data/lib/faker/omniauth.rb +110 -122
  69. data/lib/faker/parks_and_rec.rb +13 -0
  70. data/lib/faker/phone_number.rb +11 -19
  71. data/lib/faker/placeholdit.rb +11 -2
  72. data/lib/faker/princess_bride.rb +13 -0
  73. data/lib/faker/rick_and_morty.rb +1 -1
  74. data/lib/faker/science.rb +4 -2
  75. data/lib/faker/seinfeld.rb +1 -1
  76. data/lib/faker/shakespeare.rb +0 -3
  77. data/lib/faker/silicon_valley.rb +4 -0
  78. data/lib/faker/simpsons.rb +3 -8
  79. data/lib/faker/singular_siegler.rb +9 -0
  80. data/lib/faker/slack_emoji.rb +0 -2
  81. data/lib/faker/source.rb +18 -0
  82. data/lib/faker/space.rb +4 -0
  83. data/lib/faker/star_trek.rb +2 -2
  84. data/lib/faker/star_wars.rb +5 -6
  85. data/lib/faker/stranger_thing.rb +13 -0
  86. data/lib/faker/string.rb +45 -0
  87. data/lib/faker/stripe.rb +63 -0
  88. data/lib/faker/sword_art_online.rb +21 -0
  89. data/lib/faker/team.rb +4 -1
  90. data/lib/faker/the_it_crowd.rb +21 -0
  91. data/lib/faker/time.rb +10 -10
  92. data/lib/faker/twin_peaks.rb +2 -2
  93. data/lib/faker/twitter.rb +1 -1
  94. data/lib/faker/types.rb +36 -40
  95. data/lib/faker/university.rb +3 -3
  96. data/lib/faker/vehicle.rb +72 -10
  97. data/lib/faker/verb.rb +25 -0
  98. data/lib/faker/version.rb +1 -1
  99. data/lib/faker/world_cup.rb +25 -0
  100. data/lib/helpers/char.rb +19 -20
  101. data/lib/helpers/unique_generator.rb +7 -1
  102. data/lib/locales/ca-CAT.yml +1 -1
  103. data/lib/locales/da-DK.yml +1 -0
  104. data/lib/locales/de-AT.yml +3 -2
  105. data/lib/locales/de.yml +6 -5
  106. data/lib/locales/ee.yml +59 -0
  107. data/lib/locales/en-CA.yml +23 -1
  108. data/lib/locales/en-GB.yml +1 -0
  109. data/lib/locales/en-NZ.yml +4 -3
  110. data/lib/locales/en-US.yml +2 -0
  111. data/lib/locales/en.yml +2 -2
  112. data/lib/locales/en/appliance.yml +5 -0
  113. data/lib/locales/en/bank.yml +274 -59
  114. data/lib/locales/en/bojack_horseman.yml +6 -0
  115. data/lib/locales/en/cannabis.yml +12 -0
  116. data/lib/locales/en/community.yml +33 -0
  117. data/lib/locales/en/currency.yml +6 -0
  118. data/lib/locales/en/dessert.yml +3 -3
  119. data/lib/locales/en/device.yml +7 -0
  120. data/lib/locales/en/dota.yml +102 -0
  121. data/lib/locales/en/dr_who.yml +5 -1
  122. data/lib/locales/en/dumb_and_dumber.yml +1 -1
  123. data/lib/locales/en/elder_scrolls.yml +8 -5
  124. data/lib/locales/en/electrical_components.yml +6 -0
  125. data/lib/locales/en/famous_last_words.yml +4 -0
  126. data/lib/locales/en/food.yml +6 -3
  127. data/lib/locales/en/football.yml +7 -0
  128. data/lib/locales/en/gender.yml +5 -0
  129. data/lib/locales/en/greek_philosophers.yml +26 -0
  130. data/lib/locales/en/harry_potter.yml +2 -1
  131. data/lib/locales/en/invoice.yml +6 -0
  132. data/lib/locales/en/job.yml +2 -2
  133. data/lib/locales/en/lord_of_the_rings.yml +1 -0
  134. data/lib/locales/en/lorem.yml +4 -0
  135. data/lib/locales/en/michael_scott.yml +45 -0
  136. data/lib/locales/en/military.yml +8 -0
  137. data/lib/locales/en/music.yml +29 -1
  138. data/lib/locales/en/myst.yml +47 -0
  139. data/lib/locales/en/name.yml +13 -12
  140. data/lib/locales/en/nation.yml +8 -0
  141. data/lib/locales/en/nato_phonetic_alphabet.yml +4 -0
  142. data/lib/locales/en/new_girl.yml +40 -0
  143. data/lib/locales/en/overwatch.yml +3 -2
  144. data/lib/locales/en/parks_and_rec.yml +7 -0
  145. data/lib/locales/en/princess_bride.yml +5 -0
  146. data/lib/locales/en/programming_language.yml +2 -1
  147. data/lib/locales/en/science.yml +1 -0
  148. data/lib/locales/en/silicon_valley.yml +1 -0
  149. data/lib/locales/en/singular_siegler.yml +37 -0
  150. data/lib/locales/en/source.yml +16 -0
  151. data/lib/locales/en/space.yml +2 -1
  152. data/lib/locales/en/star_wars.yml +10 -0
  153. data/lib/locales/en/stranger_thing.yml +36 -0
  154. data/lib/locales/en/stripe.yml +42 -0
  155. data/lib/locales/en/sword_art_online.yml +334 -0
  156. data/lib/locales/en/team.yml +1 -1
  157. data/lib/locales/en/the_it_crowd.yml +155 -0
  158. data/lib/locales/en/vehicle.yml +24 -0
  159. data/lib/locales/en/verbs.yml +8 -0
  160. data/lib/locales/en/world_cup.yml +271 -0
  161. data/lib/locales/es.yml +6 -1
  162. data/lib/locales/fi-FI.yml +9 -4
  163. data/lib/locales/fr-CA.yml +90 -0
  164. data/lib/locales/fr-CH.yml +73 -0
  165. data/lib/locales/fr.yml +4 -2
  166. data/lib/locales/it.yml +1 -1
  167. data/lib/locales/ja.yml +11 -0
  168. data/lib/locales/lv.yml +53 -0
  169. data/lib/locales/nl.yml +1 -1
  170. data/lib/locales/no.yml +7 -0
  171. data/lib/locales/pl.yml +1 -0
  172. data/lib/locales/pt-BR.yml +21 -13
  173. data/lib/locales/pt.yml +1 -0
  174. data/lib/locales/sv.yml +4 -4
  175. data/lib/locales/tr.yml +8 -0
  176. data/lib/locales/uk.yml +9 -0
  177. metadata +167 -3
@@ -15,10 +15,13 @@ module Faker
15
15
  fetch('address.state')
16
16
  end
17
17
 
18
+ def sport
19
+ fetch('team.sport')
20
+ end
21
+
18
22
  def mascot
19
23
  fetch('team.mascot')
20
24
  end
21
25
  end
22
-
23
26
  end
24
27
  end
@@ -0,0 +1,21 @@
1
+ module Faker
2
+ class TheITCrowd < Base
3
+ class << self
4
+ def actor
5
+ fetch('the_it_crowd.actors')
6
+ end
7
+
8
+ def character
9
+ fetch('the_it_crowd.characters')
10
+ end
11
+
12
+ def email
13
+ fetch('the_it_crowd.emails')
14
+ end
15
+
16
+ def quote
17
+ fetch('the_it_crowd.quotes')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,14 +1,14 @@
1
1
  module Faker
2
2
  class Time < Faker::Date
3
3
  TIME_RANGES = {
4
- :all => (0..23),
5
- :day => (9..17),
6
- :night => (18..23),
7
- :morning => (6..11),
8
- :afternoon => (12..17),
9
- :evening => (17..21),
10
- :midnight => (0..4)
11
- }
4
+ all: (0..23),
5
+ day: (9..17),
6
+ night: (18..23),
7
+ morning: (6..11),
8
+ afternoon: (12..17),
9
+ evening: (17..21),
10
+ midnight: (0..4)
11
+ }.freeze
12
12
 
13
13
  class << self
14
14
  def between(from, to, period = :all, format = nil)
@@ -31,11 +31,11 @@ module Faker
31
31
  end
32
32
 
33
33
  def time_with_format(time, format)
34
- format.nil? ? time : I18n.l( DateTime.parse(time.to_s), :format => format )
34
+ format.nil? ? time : I18n.l(DateTime.parse(time.to_s), format: format)
35
35
  end
36
36
 
37
37
  def hours(period)
38
- raise ArgumentError, 'invalid period' unless TIME_RANGES.has_key? period
38
+ raise ArgumentError, 'invalid period' unless TIME_RANGES.key? period
39
39
  sample(TIME_RANGES[period].to_a)
40
40
  end
41
41
 
@@ -4,11 +4,11 @@ module Faker
4
4
  def character
5
5
  fetch('twin_peaks.characters')
6
6
  end
7
-
7
+
8
8
  def location
9
9
  fetch('twin_peaks.locations')
10
10
  end
11
-
11
+
12
12
  def quote
13
13
  fetch('twin_peaks.quotes')
14
14
  end
@@ -86,7 +86,7 @@ module Faker
86
86
  end
87
87
 
88
88
  def screen_name
89
- Faker::Internet.user_name(nil, ['_'])[0...20]
89
+ Faker::Internet.username(nil, ['_'])[0...20]
90
90
  end
91
91
 
92
92
  private
@@ -1,86 +1,82 @@
1
1
  module Faker
2
2
  class Types < Base
3
3
  CHARACTERS = ('0'..'9').to_a + ('a'..'z').to_a
4
- SIMPLE_TYPES = [:string, :fixnum]
5
- COMPLEX_TYPES = [:hash, :array]
6
-
4
+ SIMPLE_TYPES = %i[string fixnum].freeze
5
+ COMPLEX_TYPES = %i[hash array].freeze
6
+
7
7
  class << self
8
- def string(words=1)
8
+ def rb_string(words = 1)
9
9
  resolved_num = resolve(words)
10
- word_list = (
10
+ word_list =
11
11
  translate('faker.lorem.words')
12
- )
13
- word_list = word_list * ((resolved_num / word_list.length) + 1)
14
- shuffle(word_list)[0, resolved_num].join(" ")
12
+
13
+ word_list *= ((resolved_num / word_list.length) + 1)
14
+ shuffle(word_list)[0, resolved_num].join(' ')
15
15
  end
16
-
16
+
17
17
  def character
18
18
  sample(CHARACTERS)
19
19
  end
20
-
21
- def integer(from=0, to=100)
20
+
21
+ def rb_integer(from = 0, to = 100)
22
22
  rand(from..to).to_i
23
23
  end
24
-
25
- def hash(key_count=1)
26
- Hash.new.tap do |hsh|
27
- key_count.times do
28
- hsh.merge!({self.string.to_sym => self.random_type})
24
+
25
+ def rb_hash(key_count = 1)
26
+ {}.tap do |hsh|
27
+ Lorem.words(key_count * 2).uniq.first(key_count).each do |s|
28
+ hsh.merge!(s.to_sym => random_type)
29
29
  end
30
30
  end
31
31
  end
32
-
33
- def complex_hash(key_count=1)
34
- Hash.new.tap do |hsh|
35
- key_count.times do
36
- hsh.merge!({self.string.to_sym => self.random_complex_type})
32
+
33
+ def complex_rb_hash(key_count = 1)
34
+ {}.tap do |hsh|
35
+ Lorem.words(key_count * 2).uniq.first(key_count).each do |s|
36
+ hsh.merge!(s.to_sym => random_complex_type)
37
37
  end
38
38
  end
39
39
  end
40
-
41
- def array(len=1)
42
- Array.new.tap do |ar|
40
+
41
+ def rb_array(len = 1)
42
+ [].tap do |ar|
43
43
  len.times do
44
- ar.push self.random_type
44
+ ar.push random_type
45
45
  end
46
46
  end
47
47
  end
48
-
48
+
49
49
  def random_type
50
50
  type_to_use = SIMPLE_TYPES[rand(0..SIMPLE_TYPES.length - 1)]
51
51
  case type_to_use
52
52
  when :string
53
- self.string
53
+ rb_string
54
54
  when :fixnum
55
- self.integer
56
- else
57
- self.integer
55
+ rb_integer
58
56
  end
59
57
  end
60
-
58
+
61
59
  def random_complex_type
62
60
  types = SIMPLE_TYPES + COMPLEX_TYPES
63
61
  type_to_use = types[rand(0..types.length - 1)]
64
62
  case type_to_use
65
63
  when :string
66
- self.string
64
+ rb_string
67
65
  when :fixnum
68
- self.integer
66
+ rb_integer
69
67
  when :hash
70
- self.hash
68
+ rb_hash
71
69
  when :array
72
- self.array
73
- else
74
- self.integer
70
+ rb_array
75
71
  end
76
72
  end
77
-
73
+
78
74
  private
79
-
75
+
80
76
  def titleize(word)
81
77
  word.split(/(\W)/).map(&:capitalize).join
82
78
  end
83
-
79
+
84
80
  def resolve(value)
85
81
  case value
86
82
  when Array then sample(value)
@@ -16,12 +16,12 @@ module Faker
16
16
  end
17
17
 
18
18
  def greek_organization
19
- 3.times.map { |_| sample(greek_alphabet) }.join
19
+ Array.new(3) { |_| sample(greek_alphabet) }.join
20
20
  end
21
21
 
22
22
  def greek_alphabet
23
- ['Α', 'B', 'Γ', 'Δ', 'E', 'Z', 'H', 'Θ', 'I', 'K', 'Λ', 'M', 'N', 'Ξ',
24
- 'O', 'Π', 'P', 'Σ', 'T', 'Y', 'Φ', 'X', 'Ψ', 'Ω']
23
+ %w[Α B Γ Δ E Z H Θ I K Λ M N Ξ
24
+ O Π P Σ T Y Φ X Ψ Ω]
25
25
  end
26
26
  end
27
27
  end
@@ -2,17 +2,17 @@ module Faker
2
2
  class Vehicle < Base
3
3
  flexible :vehicle
4
4
 
5
- VIN_CHARS = '0123456789.ABCDEFGH..JKLMN.P.R..STUVWXYZ'
6
- VIN_MAP = '0123456789X'
7
- VIN_WEIGHTS = '8765432X098765432'
5
+ VIN_CHARS = '0123456789.ABCDEFGH..JKLMN.P.R..STUVWXYZ'.freeze
6
+ VIN_MAP = '0123456789X'.freeze
7
+ VIN_WEIGHTS = '8765432X098765432'.freeze
8
8
 
9
9
  class << self
10
- #ISO 3779
10
+ # ISO 3779
11
11
  def vin
12
12
  _, wmi, wmi_ext = sample(fetch_all('vehicle.manufacture'))
13
13
 
14
- c = VIN_CHARS.split('').reject{ |n| n == '.'}
15
- vehicle_identification_number = wmi.split('').concat( Array.new(14) { sample(c) } )
14
+ c = VIN_CHARS.split('').reject { |n| n == '.' }
15
+ vehicle_identification_number = wmi.split('').concat(Array.new(14) { sample(c) })
16
16
  (12..14).to_a.each_with_index { |n, i| vehicle_identification_number[n] = wmi_ext[i] } unless wmi_ext.nil?
17
17
  vehicle_identification_number[10] = fetch('vehicle.year')
18
18
  vehicle_identification_number[8] = vin_checksum(vehicle_identification_number)
@@ -24,16 +24,78 @@ module Faker
24
24
  sample(fetch_all('vehicle.manufacture')).first
25
25
  end
26
26
 
27
- private
27
+ def mileage
28
+ rand_in_range(10_000, 90_000)
29
+ end
30
+
31
+ def year
32
+ rand_in_range(2005, ::Time.now.year)
33
+ end
34
+
35
+ def make
36
+ fetch('vehicle.makes')
37
+ end
38
+
39
+ def model(make_of_model = '')
40
+ return fetch("vehicle.models_by_make.#{make}") if make_of_model.empty?
41
+ fetch("vehicle.models_by_make.#{make_of_model}")
42
+ end
43
+
44
+ def make_and_model
45
+ m = make
46
+ "#{m} #{model(m)}"
47
+ end
48
+
49
+ def style
50
+ fetch('vehicle.styles')
51
+ end
52
+
53
+ def color
54
+ fetch('vehicle.colors')
55
+ end
56
+
57
+ def transmission
58
+ fetch('vehicle.transmissions')
59
+ end
28
60
 
29
- def calculate_vin_weight(character, i)
30
- (VIN_CHARS.index(character) % 10) * VIN_MAP.index(VIN_WEIGHTS[i])
61
+ def drive_type
62
+ fetch('vehicle.drive_types')
63
+ end
64
+
65
+ def fuel_type
66
+ fetch('vehicle.fuel_types')
67
+ end
68
+
69
+ def door_count
70
+ "#{fetch('vehicle.door_count')} #{fetch('vehicle.door')}"
71
+ end
72
+
73
+ def car_type
74
+ fetch('vehicle.car_types')
75
+ end
76
+
77
+ def engine
78
+ "#{fetch('vehicle.engine_size')} #{fetch('vehicle.cylinder_engine')}"
79
+ end
80
+ alias engine_size engine
81
+
82
+ def car_options
83
+ Array.new(rand(5...10)) { fetch('vehicle.car_options') }
84
+ end
85
+
86
+ def standard_specs
87
+ Array.new(rand(5...10)) { fetch('vehicle.standard_specs') }
88
+ end
89
+
90
+ private
91
+
92
+ def calculate_vin_weight(character, idx)
93
+ (VIN_CHARS.index(character) % 10) * VIN_MAP.index(VIN_WEIGHTS[idx])
31
94
  end
32
95
 
33
96
  def vin_checksum(vehicle_identification_number)
34
97
  VIN_MAP[vehicle_identification_number.each_with_index.map(&method(:calculate_vin_weight)).inject(:+) % 11]
35
98
  end
36
-
37
99
  end
38
100
  end
39
101
  end
@@ -0,0 +1,25 @@
1
+ module Faker
2
+ class Verb < Base
3
+ class << self
4
+ def base
5
+ fetch('verbs.base')
6
+ end
7
+
8
+ def past
9
+ fetch('verbs.past')
10
+ end
11
+
12
+ def past_participle
13
+ fetch('verbs.past_participle')
14
+ end
15
+
16
+ def simple_present
17
+ fetch('verbs.simple_present')
18
+ end
19
+
20
+ def ing_form
21
+ fetch('verbs.ing_form')
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Faker #:nodoc:
2
- VERSION = "1.8.7"
2
+ VERSION = '1.9.1'.freeze
3
3
  end
@@ -0,0 +1,25 @@
1
+ module Faker
2
+ class WorldCup < Base
3
+ class << self
4
+ def team
5
+ fetch('world_cup.teams')
6
+ end
7
+
8
+ def city
9
+ fetch('world_cup.cities')
10
+ end
11
+
12
+ def stadium
13
+ fetch('world_cup.stadiums')
14
+ end
15
+
16
+ def group(group = 'group_A')
17
+ fetch("world_cup.groups.#{group}")
18
+ end
19
+
20
+ def roster(country = 'Egypt', type = 'coach')
21
+ fetch("world_cup.rosters.#{country}.#{type}")
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  module Faker
3
2
  module Char
4
3
  def self.prepare(string)
@@ -10,16 +9,16 @@ module Faker
10
9
  def self.fix_umlauts(string)
11
10
  string.gsub(/[äöüß]/i) do |match|
12
11
  case match.downcase
13
- when "ä" 'ae'
14
- when "ö" 'oe'
15
- when "ü" 'ue'
16
- when "ß" 'ss'
12
+ when 'ä' then 'ae'
13
+ when 'ö' then 'oe'
14
+ when 'ü' then 'ue'
15
+ when 'ß' then 'ss'
17
16
  end
18
17
  end
19
18
  end
20
19
 
21
20
  def self.romanize_cyrillic(string)
22
- if Faker::Config.locale == "uk"
21
+ if Faker::Config.locale == 'uk'
23
22
  # Based on conventions abopted by BGN/PCGN for Ukrainian
24
23
  uk_chars = {
25
24
  'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'h', 'ґ' => 'g', 'д' => 'd',
@@ -39,22 +38,22 @@ module Faker
39
38
  return string.gsub(/[а-яА-ЯіїєґІЇЄҐ]/, uk_chars)
40
39
  end
41
40
 
42
- if Faker::Config.locale == "ru"
41
+ if Faker::Config.locale == 'ru'
43
42
  # Based on conventions abopted by BGN/PCGN for Russian
44
43
  ru_chars = {
45
- 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'h', 'д' => 'd', 'е' => 'e',
46
- 'ё' => 'ye', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k',
47
- 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r',
48
- 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'kh', 'ц' => 'ts',
49
- 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'у', 'э' => 'e', 'ю' => 'yu',
50
- 'я' => 'ya',
51
- 'А' => 'a', 'Б' => 'b', 'В' => 'v', 'Г' => 'h', 'Д' => 'd', 'Е' => 'e',
52
- 'Ё' => 'ye', 'Ж' => 'zh', 'З' => 'z', 'И' => 'i', 'Й' => 'y', 'К' => 'k',
53
- 'Л' => 'l', 'М' => 'm', 'Н' => 'n', 'О' => 'o', 'П' => 'p', 'Р' => 'r',
54
- 'С' => 's', 'Т' => 't', 'У' => 'u', 'Ф' => 'f', 'Х' => 'kh', 'Ц' => 'ts',
55
- 'Ч' => 'ch', 'Ш' => 'sh', 'Щ' => 'shch', 'Ы' => 'у', 'Э' => 'e', 'Ю' => 'yu',
56
- 'Я' => 'ya',
57
- 'ь' => '', 'ъ' => '' # Ignore symbols, because its standard presentation is not allowed in URLs
44
+ 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'h', 'д' => 'd', 'е' => 'e',
45
+ 'ё' => 'ye', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k',
46
+ 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r',
47
+ 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'kh', 'ц' => 'ts',
48
+ 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'у', 'э' => 'e', 'ю' => 'yu',
49
+ 'я' => 'ya',
50
+ 'А' => 'a', 'Б' => 'b', 'В' => 'v', 'Г' => 'h', 'Д' => 'd', 'Е' => 'e',
51
+ 'Ё' => 'ye', 'Ж' => 'zh', 'З' => 'z', 'И' => 'i', 'Й' => 'y', 'К' => 'k',
52
+ 'Л' => 'l', 'М' => 'm', 'Н' => 'n', 'О' => 'o', 'П' => 'p', 'Р' => 'r',
53
+ 'С' => 's', 'Т' => 't', 'У' => 'u', 'Ф' => 'f', 'Х' => 'kh', 'Ц' => 'ts',
54
+ 'Ч' => 'ch', 'Ш' => 'sh', 'Щ' => 'shch', 'Ы' => 'у', 'Э' => 'e', 'Ю' => 'yu',
55
+ 'Я' => 'ya',
56
+ 'ь' => '', 'ъ' => '' # Ignore symbols, because its standard presentation is not allowed in URLs
58
57
  }
59
58
  return string.gsub(/[а-яА-Я]/, ru_chars)
60
59
  end