ruby-nuggets 0.6.9 → 0.7.0
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.
- data/.rspec +1 -0
- data/README +1 -1
- data/Rakefile +4 -4
- data/lib/nuggets/array/correlation.rb +5 -0
- data/lib/nuggets/array/correlation_mixin.rb +62 -0
- data/lib/nuggets/array/histogram.rb +5 -0
- data/lib/nuggets/array/histogram_mixin.rb +155 -0
- data/lib/nuggets/array/mean.rb +5 -0
- data/lib/nuggets/array/mean_mixin.rb +139 -0
- data/lib/nuggets/array/median.rb +5 -0
- data/lib/nuggets/array/median_mixin.rb +74 -0
- data/lib/nuggets/array/mode.rb +5 -0
- data/lib/nuggets/array/mode_mixin.rb +70 -0
- data/lib/nuggets/array/monotone.rb +5 -5
- data/lib/nuggets/array/only.rb +3 -2
- data/lib/nuggets/array/regression.rb +5 -0
- data/lib/nuggets/array/regression_mixin.rb +63 -0
- data/lib/nuggets/array/runiq_mixin.rb +1 -1
- data/lib/nuggets/array/standard_deviation_mixin.rb +5 -8
- data/lib/nuggets/array/variance_mixin.rb +30 -11
- data/lib/nuggets/enumerable/all_any_extended.rb +6 -6
- data/lib/nuggets/enumerable/minmax.rb +2 -2
- data/lib/nuggets/env/set_mixin.rb +4 -4
- data/lib/nuggets/env/user_home_mixin.rb +1 -1
- data/lib/nuggets/file/replace_mixin.rb +3 -3
- data/lib/nuggets/file/sub_mixin.rb +2 -2
- data/lib/nuggets/file/which_mixin.rb +15 -14
- data/lib/nuggets/hash/nest_mixin.rb +3 -3
- data/lib/nuggets/hash/only.rb +6 -4
- data/lib/nuggets/hash/unroll_mixin.rb +1 -1
- data/lib/nuggets/io/modes.rb +12 -12
- data/lib/nuggets/numeric/duration.rb +3 -3
- data/lib/nuggets/object/blank_mixin.rb +6 -6
- data/lib/nuggets/object/boolean_mixin.rb +3 -3
- data/lib/nuggets/object/singleton_class_mixin.rb +3 -3
- data/lib/nuggets/range/quantile_mixin.rb +1 -1
- data/lib/nuggets/statistics.rb +11 -0
- data/lib/nuggets/statistics_mixins.rb +11 -0
- data/lib/nuggets/string/case.rb +4 -4
- data/lib/nuggets/string/msub.rb +1 -1
- data/lib/nuggets/string/nsub.rb +2 -2
- data/lib/nuggets/string/sub_with_md.rb +2 -2
- data/lib/nuggets/tempfile/open.rb +1 -1
- data/lib/nuggets/uri/content_type_mixin.rb +1 -1
- data/lib/nuggets/uri/exist_mixin.rb +2 -2
- data/lib/nuggets/util/content_type.rb +1 -1
- data/lib/nuggets/util/i18n.rb +63 -63
- data/lib/nuggets/util/ruby.rb +7 -7
- data/lib/nuggets/version.rb +2 -2
- data/spec/nuggets/array/mean_spec.rb +127 -0
- data/spec/nuggets/array/median_spec.rb +79 -0
- data/spec/nuggets/array/mode_spec.rb +59 -0
- data/spec/nuggets/string/evaluate_spec.rb +2 -2
- metadata +29 -15
@@ -30,9 +30,9 @@ module Nuggets
|
|
30
30
|
module NestMixin
|
31
31
|
|
32
32
|
# call-seq:
|
33
|
-
# Hash.nest(depth
|
34
|
-
# Hash.nest(depth
|
35
|
-
# Hash.nest(depth
|
33
|
+
# Hash.nest([depth]) => aHash
|
34
|
+
# Hash.nest([depth[, value]]) => aHash
|
35
|
+
# Hash.nest([depth]) { |key| ... } => aHash
|
36
36
|
#
|
37
37
|
# Creates a nested hash, +depth+ levels deep. The final hash will receive a
|
38
38
|
# default value of +value+ or, if +value+ is not given but a block is given,
|
data/lib/nuggets/hash/only.rb
CHANGED
@@ -30,10 +30,11 @@ require 'nuggets/hash/at'
|
|
30
30
|
class Hash
|
31
31
|
|
32
32
|
# call-seq:
|
33
|
-
# hash.only
|
33
|
+
# hash.only => aHash
|
34
|
+
# hash.only(+true+) => aHash
|
34
35
|
#
|
35
36
|
# Returns the only key/value pair of _hash_. Raises an IndexError if _hash_'s
|
36
|
-
# size is not 1, unless +
|
37
|
+
# size is not 1, unless parameter +true+ is passed.
|
37
38
|
def only(relax = size == 1, split = false)
|
38
39
|
raise IndexError, 'not a single-element hash' unless relax
|
39
40
|
|
@@ -41,10 +42,11 @@ class Hash
|
|
41
42
|
end
|
42
43
|
|
43
44
|
# call-seq:
|
44
|
-
# hash.only_pair
|
45
|
+
# hash.only_pair => anArray
|
46
|
+
# hash.only_pair(+true+) => anArray
|
45
47
|
#
|
46
48
|
# Returns the only key/value pair of _hash_ as an array. Raises an IndexError
|
47
|
-
# if _hash_'s size is not 1, unless +
|
49
|
+
# if _hash_'s size is not 1, unless parameter +true+ is passed.
|
48
50
|
def only_pair(relax = size == 1)
|
49
51
|
only(relax, true)
|
50
52
|
end
|
@@ -31,7 +31,7 @@ module Nuggets
|
|
31
31
|
|
32
32
|
# call-seq:
|
33
33
|
# hash.unroll(*value_keys) => anArray
|
34
|
-
# hash.unroll(*value_keys, :
|
34
|
+
# hash.unroll(*value_keys, :sort_by => ...) => anArray
|
35
35
|
# hash.unroll(*value_keys) { |value_hash| ... } => anArray
|
36
36
|
#
|
37
37
|
# "Unrolls" a nested hash, so that each path through _hash_ results in a
|
data/lib/nuggets/io/modes.rb
CHANGED
@@ -34,8 +34,8 @@ class IO
|
|
34
34
|
alias_method :_nuggets_original_read, :read
|
35
35
|
|
36
36
|
# call-seq:
|
37
|
-
# IO.read(name,
|
38
|
-
# IO.read(name, binary
|
37
|
+
# IO.read(name[, length[, offset]]]) => aString
|
38
|
+
# IO.read(name[, binary]) { |io| ... } => anObject
|
39
39
|
#
|
40
40
|
# Opens +name+ with mode +r+. NOTE: With no associated block,
|
41
41
|
# acts like the original IO::read, not like IO::new.
|
@@ -60,8 +60,8 @@ class IO
|
|
60
60
|
end
|
61
61
|
|
62
62
|
# call-seq:
|
63
|
-
# IO.write(name, binary
|
64
|
-
# IO.write(name, binary
|
63
|
+
# IO.write(name[, binary]) => anIO
|
64
|
+
# IO.write(name[, binary]) { |io| ... } => anObject
|
65
65
|
#
|
66
66
|
# Opens +name+ with mode +w+.
|
67
67
|
def write(name, binary = false)
|
@@ -69,8 +69,8 @@ class IO
|
|
69
69
|
end
|
70
70
|
|
71
71
|
# call-seq:
|
72
|
-
# IO.append(name, binary
|
73
|
-
# IO.append(name, binary
|
72
|
+
# IO.append(name[, binary]) => anIO
|
73
|
+
# IO.append(name[, binary]) { |io| ... } => anObject
|
74
74
|
#
|
75
75
|
# Opens +name+ with mode +a+.
|
76
76
|
def append(name, binary = false)
|
@@ -78,8 +78,8 @@ class IO
|
|
78
78
|
end
|
79
79
|
|
80
80
|
# call-seq:
|
81
|
-
# IO.read_write(name, binary
|
82
|
-
# IO.read_write(name, binary
|
81
|
+
# IO.read_write(name[, binary]) => anIO
|
82
|
+
# IO.read_write(name[, binary]) { |io| ... } => anObject
|
83
83
|
#
|
84
84
|
# Opens +name+ with mode <tt>r+</tt>.
|
85
85
|
def read_write(name, binary = false)
|
@@ -87,8 +87,8 @@ class IO
|
|
87
87
|
end
|
88
88
|
|
89
89
|
# call-seq:
|
90
|
-
# IO.write_read(name, binary
|
91
|
-
# IO.write_read(name, binary
|
90
|
+
# IO.write_read(name[, binary]) => anIO
|
91
|
+
# IO.write_read(name[, binary]) { |io| ... } => anObject
|
92
92
|
#
|
93
93
|
# Opens +name+ with mode <tt>w+</tt>.
|
94
94
|
def write_read(name, binary = false)
|
@@ -96,8 +96,8 @@ class IO
|
|
96
96
|
end
|
97
97
|
|
98
98
|
# call-seq:
|
99
|
-
# IO.append_read(name, binary
|
100
|
-
# IO.append_read(name, binary
|
99
|
+
# IO.append_read(name[, binary]) => anIO
|
100
|
+
# IO.append_read(name[, binary]) { |io| ... } => anObject
|
101
101
|
#
|
102
102
|
# Opens +name+ with mode <tt>a+</tt>.
|
103
103
|
def append_read(name, binary = false)
|
@@ -58,7 +58,7 @@ class Numeric
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# call-seq:
|
61
|
-
# num.to_hms(precision
|
61
|
+
# num.to_hms([precision[, labels]]) => aString
|
62
62
|
#
|
63
63
|
# Produces a stringified version of _num_'s time portions (cf. #hms),
|
64
64
|
# with the specified +precision+ for the seconds (treated as floating
|
@@ -82,11 +82,11 @@ class Numeric
|
|
82
82
|
end
|
83
83
|
|
84
84
|
# call-seq:
|
85
|
-
# num.to_ymd(include_hms
|
85
|
+
# num.to_ymd([include_hms[, labels]]) => aString
|
86
86
|
#
|
87
87
|
# Produces a stringified version of _num_'s date portions (cf. #ymd),
|
88
88
|
# analogous to #to_hms. Includes time portions (cf. #hms) if +include_hms+
|
89
|
-
# is true
|
89
|
+
# is +true+.
|
90
90
|
def to_ymd(include_hms = false, labels = %w[y m d])
|
91
91
|
unless include_hms
|
92
92
|
to_hms(0, labels, ymd)
|
@@ -30,7 +30,7 @@ module Nuggets
|
|
30
30
|
module BlankMixin
|
31
31
|
|
32
32
|
# call-seq:
|
33
|
-
# object.blank? => true or false
|
33
|
+
# object.blank? => +true+ or +false+
|
34
34
|
#
|
35
35
|
# Basically a short-cut to <tt>object.nil? || object.empty?</tt>.
|
36
36
|
def blank?(*modifiers)
|
@@ -58,7 +58,7 @@ module Nuggets
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# call-seq:
|
61
|
-
# object.void? => true or false
|
61
|
+
# object.void? => +true+ or +false+
|
62
62
|
#
|
63
63
|
# Adds white-space strings, 0 and arrays of +nil+ objects to the list of
|
64
64
|
# blank objects.
|
@@ -74,9 +74,9 @@ module Nuggets
|
|
74
74
|
module BlankMixin
|
75
75
|
|
76
76
|
# call-seq:
|
77
|
-
# array.vain? => true or false
|
77
|
+
# array.vain? => +true+ or +false+
|
78
78
|
#
|
79
|
-
# Returns true if all of _array_'s elements are themselves vain.
|
79
|
+
# Returns +true+ if all of _array_'s elements are themselves vain.
|
80
80
|
def vain?
|
81
81
|
blank? { |a| a.delete_if { |i| i.vain? } }
|
82
82
|
end
|
@@ -88,9 +88,9 @@ module Nuggets
|
|
88
88
|
module BlankMixin
|
89
89
|
|
90
90
|
# call-seq:
|
91
|
-
# hash.vain? => true or false
|
91
|
+
# hash.vain? => +true+ or +false+
|
92
92
|
#
|
93
|
-
# Returns true if all of _hash_'s values are themselves vain.
|
93
|
+
# Returns +true+ if all of _hash_'s values are themselves vain.
|
94
94
|
def vain?
|
95
95
|
blank? { |h| h.delete_if { |_, v| v.vain? } }
|
96
96
|
end
|
@@ -30,7 +30,7 @@ module Nuggets
|
|
30
30
|
module BooleanMixin
|
31
31
|
|
32
32
|
# call-seq:
|
33
|
-
# object.boolean? => true or false
|
33
|
+
# object.boolean? => +true+ or +false+
|
34
34
|
#
|
35
35
|
#
|
36
36
|
def boolean?
|
@@ -38,7 +38,7 @@ module Nuggets
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# call-seq:
|
41
|
-
# object.negate => true or false
|
41
|
+
# object.negate => +true+ or +false+
|
42
42
|
#
|
43
43
|
#
|
44
44
|
def negate
|
@@ -48,7 +48,7 @@ module Nuggets
|
|
48
48
|
alias_method :false?, :negate
|
49
49
|
|
50
50
|
# call-seq:
|
51
|
-
# object.to_bool => true or false
|
51
|
+
# object.to_bool => +true+ or +false+
|
52
52
|
#
|
53
53
|
#
|
54
54
|
def to_bool
|
@@ -74,10 +74,10 @@ module Nuggets
|
|
74
74
|
alias_method :singleton_instance, :singleton_object
|
75
75
|
|
76
76
|
# call-seq:
|
77
|
-
# object.singleton_class? => true or false
|
77
|
+
# object.singleton_class? => +true+ or +false+
|
78
78
|
#
|
79
|
-
# Returns true if _object_ is a singleton_class
|
80
|
-
# (i.e., has a singleton_object), false otherwise.
|
79
|
+
# Returns +true+ if _object_ is a singleton_class
|
80
|
+
# (i.e., has a singleton_object), +false+ otherwise.
|
81
81
|
def singleton_class?
|
82
82
|
singleton_object
|
83
83
|
true
|
@@ -30,7 +30,7 @@ module Nuggets
|
|
30
30
|
module QuantileMixin
|
31
31
|
|
32
32
|
# call-seq:
|
33
|
-
# range.quantile(value, order
|
33
|
+
# range.quantile(value[, order]) => anInteger
|
34
34
|
#
|
35
35
|
# Determines the <tt>order</tt>-quantile of +value+ in _range_.
|
36
36
|
def quantile(value, order = 100)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# load statistics related nuggets
|
2
|
+
|
3
|
+
require 'nuggets/array/correlation'
|
4
|
+
require 'nuggets/array/histogram'
|
5
|
+
require 'nuggets/array/mean'
|
6
|
+
require 'nuggets/array/median'
|
7
|
+
require 'nuggets/array/mode'
|
8
|
+
require 'nuggets/array/regression'
|
9
|
+
require 'nuggets/array/standard_deviation'
|
10
|
+
require 'nuggets/array/variance'
|
11
|
+
require 'nuggets/range/quantile'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# load statistics related nuggets (mixins)
|
2
|
+
|
3
|
+
require 'nuggets/array/correlation_mixin'
|
4
|
+
require 'nuggets/array/histogram_mixin'
|
5
|
+
require 'nuggets/array/mean_mixin'
|
6
|
+
require 'nuggets/array/median_mixin'
|
7
|
+
require 'nuggets/array/mode_mixin'
|
8
|
+
require 'nuggets/array/regression_mixin'
|
9
|
+
require 'nuggets/array/standard_deviation_mixin'
|
10
|
+
require 'nuggets/array/variance_mixin'
|
11
|
+
require 'nuggets/range/quantile_mixin'
|
data/lib/nuggets/string/case.rb
CHANGED
@@ -46,7 +46,7 @@ class String
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# call-seq:
|
49
|
-
# str.lower_case? => true or false
|
49
|
+
# str.lower_case? => +true+ or +false+
|
50
50
|
#
|
51
51
|
# Tell whether _str_ is all lower case.
|
52
52
|
def lower_case?
|
@@ -55,7 +55,7 @@ class String
|
|
55
55
|
alias_method :downcase?, :lower_case?
|
56
56
|
|
57
57
|
# call-seq:
|
58
|
-
# str.upper_case? => true or false
|
58
|
+
# str.upper_case? => +true+ or +false+
|
59
59
|
#
|
60
60
|
# Tell whether _str_ is all upper case.
|
61
61
|
def upper_case?
|
@@ -64,7 +64,7 @@ class String
|
|
64
64
|
alias_method :upcase?, :upper_case?
|
65
65
|
|
66
66
|
# call-seq:
|
67
|
-
# str.mixed_case? => true or false
|
67
|
+
# str.mixed_case? => +true+ or +false+
|
68
68
|
#
|
69
69
|
# Tell whether _str_ is mixed case.
|
70
70
|
def mixed_case?
|
@@ -72,7 +72,7 @@ class String
|
|
72
72
|
end
|
73
73
|
|
74
74
|
# call-seq:
|
75
|
-
# str.capitalized? => true or false
|
75
|
+
# str.capitalized? => +true+ or +false+
|
76
76
|
#
|
77
77
|
# Tell whether _str_ is capitalized.
|
78
78
|
def capitalized?
|
data/lib/nuggets/string/msub.rb
CHANGED
data/lib/nuggets/string/nsub.rb
CHANGED
@@ -41,8 +41,8 @@ class String
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# call-seq:
|
44
|
-
# str.nsub!(pattern, replacement, count) => str or nil
|
45
|
-
# str.nsub!(pattern, count) { |match| ... } => str or nil
|
44
|
+
# str.nsub!(pattern, replacement, count) => str or +nil+
|
45
|
+
# str.nsub!(pattern, count) { |match| ... } => str or +nil+
|
46
46
|
#
|
47
47
|
# Performs the substitutions of #nsub in place, returning _str_, or +nil+ if
|
48
48
|
# no substitutions were performed.
|
@@ -44,7 +44,7 @@ class String
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# call-seq:
|
47
|
-
# str.sub_with_md!(pattern) { |match_data| ... } => str or nil
|
47
|
+
# str.sub_with_md!(pattern) { |match_data| ... } => str or +nil+
|
48
48
|
#
|
49
49
|
# Destructive version of #sub_with_md.
|
50
50
|
def sub_with_md!(pattern, replacement = nil)
|
@@ -65,7 +65,7 @@ class String
|
|
65
65
|
end
|
66
66
|
|
67
67
|
# call-seq:
|
68
|
-
# str.gsub_with_md!(pattern) { |match_data| ... } => str or nil
|
68
|
+
# str.gsub_with_md!(pattern) { |match_data| ... } => str or +nil+
|
69
69
|
#
|
70
70
|
# Destructive version of #gsub_with_md.
|
71
71
|
def gsub_with_md!(pattern, replacement = nil)
|
@@ -38,7 +38,7 @@ class Tempfile
|
|
38
38
|
# If a block is given, it will be passed tempfile as an argument,
|
39
39
|
# and the tempfile will automatically be closed when the block
|
40
40
|
# terminates. In this case, open() returns tempfile -- in contrast
|
41
|
-
# to the original implementation, which returns nil
|
41
|
+
# to the original implementation, which returns +nil+.
|
42
42
|
def open(*args)
|
43
43
|
tempfile = new(*args)
|
44
44
|
|
@@ -32,9 +32,9 @@ module Nuggets
|
|
32
32
|
module ExistMixin
|
33
33
|
|
34
34
|
# call-seq:
|
35
|
-
# URI.exist?(uri) => true or false
|
35
|
+
# URI.exist?(uri) => +true+ or +false+
|
36
36
|
#
|
37
|
-
# Return +true+ if the
|
37
|
+
# Return +true+ if the URI +uri+ exists.
|
38
38
|
def exist?(uri)
|
39
39
|
open(uri.to_s)
|
40
40
|
true
|
@@ -67,7 +67,7 @@ module Util
|
|
67
67
|
extend self
|
68
68
|
|
69
69
|
# call-seq:
|
70
|
-
# ContentType.of(path) => aString or nil
|
70
|
+
# ContentType.of(path) => aString or +nil+
|
71
71
|
#
|
72
72
|
# Get the MIME-Type of the file living at +path+. Either by looking
|
73
73
|
# directly into the file (requires FileMagic), or, assuming +path+
|
data/lib/nuggets/util/i18n.rb
CHANGED
@@ -32,68 +32,68 @@ module Util
|
|
32
32
|
module I18n
|
33
33
|
|
34
34
|
DIACRITICS = {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
35
|
+
'À' => 'A', # LATIN CAPITAL LETTER A WITH GRAVE
|
36
|
+
'Á' => 'A', # LATIN CAPITAL LETTER A WITH ACUTE
|
37
|
+
'Â' => 'A', # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
|
38
|
+
'Ã' => 'A', # LATIN CAPITAL LETTER A WITH TILDE
|
39
|
+
'Ä' => 'AE', # LATIN CAPITAL LETTER A WITH DIAERESIS
|
40
|
+
'Å' => 'A', # LATIN CAPITAL LETTER A WITH RING ABOVE
|
41
|
+
'Æ' => 'AE', # LATIN CAPITAL LETTER AE
|
42
|
+
'Ç' => 'C', # LATIN CAPITAL LETTER C WITH CEDILLA
|
43
|
+
'È' => 'E', # LATIN CAPITAL LETTER E WITH GRAVE
|
44
|
+
'É' => 'E', # LATIN CAPITAL LETTER E WITH ACUTE
|
45
|
+
'Ê' => 'E', # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
|
46
|
+
'Ë' => 'E', # LATIN CAPITAL LETTER E WITH DIAERESIS
|
47
|
+
'Ì' => 'I', # LATIN CAPITAL LETTER I WITH GRAVE
|
48
|
+
'Í' => 'I', # LATIN CAPITAL LETTER I WITH ACUTE
|
49
|
+
'Î' => 'I', # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
|
50
|
+
'Ï' => 'I', # LATIN CAPITAL LETTER I WITH DIAERESIS
|
51
|
+
'Ð' => 'DH', # LATIN CAPITAL LETTER ETH
|
52
|
+
'Ñ' => 'N', # LATIN CAPITAL LETTER N WITH TILDE
|
53
|
+
'Ò' => 'O', # LATIN CAPITAL LETTER O WITH GRAVE
|
54
|
+
'Ó' => 'O', # LATIN CAPITAL LETTER O WITH ACUTE
|
55
|
+
'Ô' => 'O', # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
|
56
|
+
'Õ' => 'O', # LATIN CAPITAL LETTER O WITH TILDE
|
57
|
+
'Ö' => 'OE', # LATIN CAPITAL LETTER O WITH DIAERESIS
|
58
|
+
'Ø' => 'O', # LATIN CAPITAL LETTER O WITH STROKE
|
59
|
+
'Ù' => 'U', # LATIN CAPITAL LETTER U WITH GRAVE
|
60
|
+
'Ú' => 'U', # LATIN CAPITAL LETTER U WITH ACUTE
|
61
|
+
'Û' => 'U', # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
|
62
|
+
'Ü' => 'UE', # LATIN CAPITAL LETTER U WITH DIAERESIS
|
63
|
+
'Ý' => 'Y', # LATIN CAPITAL LETTER Y WITH ACUTE
|
64
|
+
'Þ' => 'TH', # LATIN CAPITAL LETTER THORN
|
65
|
+
'ß' => 'ss', # LATIN SMALL LETTER SHARP S
|
66
|
+
'à' => 'a', # LATIN SMALL LETTER A WITH GRAVE
|
67
|
+
'á' => 'a', # LATIN SMALL LETTER A WITH ACUTE
|
68
|
+
'â' => 'a', # LATIN SMALL LETTER A WITH CIRCUMFLEX
|
69
|
+
'ã' => 'a', # LATIN SMALL LETTER A WITH TILDE
|
70
|
+
'ä' => 'ae', # LATIN SMALL LETTER A WITH DIAERESIS
|
71
|
+
'å' => 'a', # LATIN SMALL LETTER A WITH RING ABOVE
|
72
|
+
'æ' => 'ae', # LATIN SMALL LETTER AE
|
73
|
+
'ç' => 'c', # LATIN SMALL LETTER C WITH CEDILLA
|
74
|
+
'è' => 'e', # LATIN SMALL LETTER E WITH GRAVE
|
75
|
+
'é' => 'e', # LATIN SMALL LETTER E WITH ACUTE
|
76
|
+
'ê' => 'e', # LATIN SMALL LETTER E WITH CIRCUMFLEX
|
77
|
+
'ë' => 'e', # LATIN SMALL LETTER E WITH DIAERESIS
|
78
|
+
'ì' => 'i', # LATIN SMALL LETTER I WITH GRAVE
|
79
|
+
'í' => 'i', # LATIN SMALL LETTER I WITH ACUTE
|
80
|
+
'î' => 'i', # LATIN SMALL LETTER I WITH CIRCUMFLEX
|
81
|
+
'ï' => 'i', # LATIN SMALL LETTER I WITH DIAERESIS
|
82
|
+
'ð' => 'dh', # LATIN SMALL LETTER ETH
|
83
|
+
'ñ' => 'n', # LATIN SMALL LETTER N WITH TILDE
|
84
|
+
'ò' => 'o', # LATIN SMALL LETTER O WITH GRAVE
|
85
|
+
'ó' => 'o', # LATIN SMALL LETTER O WITH ACUTE
|
86
|
+
'ô' => 'o', # LATIN SMALL LETTER O WITH CIRCUMFLEX
|
87
|
+
'õ' => 'o', # LATIN SMALL LETTER O WITH TILDE
|
88
|
+
'ö' => 'oe', # LATIN SMALL LETTER O WITH DIAERESIS
|
89
|
+
'ø' => 'o', # LATIN SMALL LETTER O WITH STROKE
|
90
|
+
'ù' => 'u', # LATIN SMALL LETTER U WITH GRAVE
|
91
|
+
'ú' => 'u', # LATIN SMALL LETTER U WITH ACUTE
|
92
|
+
'û' => 'u', # LATIN SMALL LETTER U WITH CIRCUMFLEX
|
93
|
+
'ü' => 'ue', # LATIN SMALL LETTER U WITH DIAERESIS
|
94
|
+
'ý' => 'y', # LATIN SMALL LETTER Y WITH ACUTE
|
95
|
+
'þ' => 'th', # LATIN SMALL LETTER THORN
|
96
|
+
'ÿ' => 'y' # LATIN SMALL LETTER Y WITH DIAERESIS
|
97
97
|
}
|
98
98
|
|
99
99
|
end
|
@@ -112,7 +112,7 @@ class String
|
|
112
112
|
end
|
113
113
|
|
114
114
|
# call-seq:
|
115
|
-
# str.replace_diacritics! => str or nil
|
115
|
+
# str.replace_diacritics! => str or +nil+
|
116
116
|
#
|
117
117
|
# Destructive version of #replace_diacritics.
|
118
118
|
def replace_diacritics!
|