lazier 3.5.1 → 3.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/.rubocop.yml +29 -0
  4. data/.travis-gemfile +1 -1
  5. data/.travis.yml +2 -2
  6. data/CHANGELOG.md +5 -0
  7. data/Gemfile +3 -3
  8. data/README.md +1 -1
  9. data/doc/Lazier.html +56 -68
  10. data/doc/Lazier/Boolean.html +4 -4
  11. data/doc/Lazier/Configuration.html +5 -5
  12. data/doc/Lazier/DateTime.html +29 -29
  13. data/doc/Lazier/DateTime/ClassMethods.html +136 -124
  14. data/doc/Lazier/Exceptions.html +4 -4
  15. data/doc/Lazier/Exceptions/Debug.html +4 -4
  16. data/doc/Lazier/Exceptions/MissingTranslation.html +4 -4
  17. data/doc/Lazier/Hash.html +144 -32
  18. data/doc/Lazier/I18n.html +109 -103
  19. data/doc/Lazier/Localizer.html +4 -4
  20. data/doc/Lazier/Math.html +4 -4
  21. data/doc/Lazier/Math/ClassMethods.html +4 -4
  22. data/doc/Lazier/Object.html +357 -243
  23. data/doc/Lazier/Pathname.html +4 -4
  24. data/doc/Lazier/Settings.html +58 -34
  25. data/doc/Lazier/String.html +6 -6
  26. data/doc/Lazier/TimeZone.html +86 -86
  27. data/doc/Lazier/TimeZone/ClassMethods.html +66 -68
  28. data/doc/Lazier/Version.html +5 -5
  29. data/doc/_index.html +5 -5
  30. data/doc/css/style.css +1 -0
  31. data/doc/file.README.html +4 -4
  32. data/doc/frames.html +1 -1
  33. data/doc/index.html +4 -4
  34. data/doc/method_list.html +103 -91
  35. data/doc/top-level-namespace.html +4 -4
  36. data/lazier.gemspec +2 -2
  37. data/lib/lazier.rb +59 -22
  38. data/lib/lazier/boolean.rb +1 -1
  39. data/lib/lazier/configuration.rb +21 -20
  40. data/lib/lazier/datetime.rb +127 -101
  41. data/lib/lazier/hash.rb +20 -12
  42. data/lib/lazier/i18n.rb +33 -32
  43. data/lib/lazier/math.rb +1 -1
  44. data/lib/lazier/object.rb +102 -56
  45. data/lib/lazier/pathname.rb +1 -1
  46. data/lib/lazier/settings.rb +4 -2
  47. data/lib/lazier/string.rb +3 -3
  48. data/lib/lazier/version.rb +1 -1
  49. data/spec/lazier/datetime_spec.rb +1 -1
  50. data/spec/lazier/hash_spec.rb +2 -2
  51. data/spec/lazier/object_spec.rb +16 -0
  52. data/spec/lazier/string_spec.rb +4 -10
  53. data/spec/lazier_spec.rb +9 -9
  54. data/spec/spec_helper.rb +1 -1
  55. metadata +7 -6
data/lib/lazier/hash.rb CHANGED
@@ -22,8 +22,7 @@ module Lazier
22
22
  # @param validator [Proc], if present all the keys which evaluates to true will be removed. Otherwise all blank values will be removed.
23
23
  # @return [Hash] The hash with all blank values removed.
24
24
  def compact(&validator)
25
- validator ||= ->(_, v) { v.blank? }
26
- reject(&validator)
25
+ dup.compact!(&validator)
27
26
  end
28
27
 
29
28
  # Compacts the current hash, removing all keys which values are blank.
@@ -39,7 +38,7 @@ module Lazier
39
38
  # @param accesses [Array] The requested access for the keys. Can be `:strings`, `:symbols` or `:indifferent`. If `nil` the keys are not modified.
40
39
  # @return [Hash] The current hash with keys modified.
41
40
  def ensure_access(*accesses)
42
- accesses.compact.inject(self) do |rv, access|
41
+ accesses.compact.reduce(self) do |rv, access|
43
42
  method = VALID_ACCESSES.fetch(access.ensure_string.to_sym, nil)
44
43
  rv = rv.send(method) if method
45
44
  rv
@@ -53,19 +52,28 @@ module Lazier
53
52
  def enable_dotted_access(readonly = true)
54
53
  extend(Hashie::Extensions::MethodReader)
55
54
  extend(Hashie::Extensions::MethodQuery)
56
- extend(Hashie::Extensions::MethodWriter) if !readonly
55
+ extend(Hashie::Extensions::MethodWriter) unless readonly
57
56
 
58
57
  each do |_, value|
59
- if value.is_a?(Hash) then
60
- value.enable_dotted_access(readonly)
61
- elsif value.respond_to?(:each) then
62
- value.each do |element|
63
- element.enable_dotted_access(readonly) if element.is_a?(Hash)
64
- end
65
- end
58
+ enable_dotted_access_for_value(value, readonly)
66
59
  end
67
60
 
68
61
  self
69
62
  end
63
+
64
+ # Makes sure that the value is accessible using dotted notation. This is also applied to every embedded hash.
65
+ #
66
+ # @param value [Object] The value to manipulate.
67
+ # @param readonly [Boolean] If the dotted notation is only enable for reading. `true` by default.
68
+ # @return [Hash] The current value enabled for dotted access.
69
+ def enable_dotted_access_for_value(value, readonly)
70
+ if value.is_a?(Hash)
71
+ value.enable_dotted_access(readonly)
72
+ elsif value.respond_to?(:each) then
73
+ value.each do |element|
74
+ element.enable_dotted_access(readonly) if element.is_a?(Hash)
75
+ end
76
+ end
77
+ end
70
78
  end
71
- end
79
+ end
data/lib/lazier/i18n.rb CHANGED
@@ -45,40 +45,41 @@ module Lazier
45
45
  end
46
46
 
47
47
  private
48
- # Loads a locale for messages.
49
- #
50
- # @param locale [Symbol] The new locale. Default is the current system locale.
51
- # @return [R18n::Translation] The new translation object.
52
- def i18n_load_locale(locale)
53
- path = @i18n_locales_path || ""
54
- locales = validate_locales([locale], path)
55
48
 
56
- begin
57
- tokens = @i18n_root.to_s.split(/[:.]/)
58
- translation = tokens.reduce(R18n::I18n.new(locales, path).t) {|accu, token| accu.send(token) }
59
- raise ArgumentError if translation.is_a?(R18n::Untranslated)
60
- translation
61
- rescue
62
- raise Lazier::Exceptions::MissingTranslation.new(locales, path)
63
- end
64
- end
49
+ # Loads a locale for messages.
50
+ #
51
+ # @param locale [Symbol] The new locale. Default is the current system locale.
52
+ # @return [R18n::Translation] The new translation object.
53
+ def i18n_load_locale(locale)
54
+ path = @i18n_locales_path || ""
55
+ locales = validate_locales([locale], path)
65
56
 
66
- # Validates locales for messages.
67
- #
68
- # @param locales [Array] The list of locales to validate. English is added as fallback.
69
- # @param path [String] The path where look into.
70
- # @return [Array] The list of valid locales.
71
- def validate_locales(locales, path)
72
- (locales + [ENV["LANG"], R18n::I18n.system_locale, "en"]).select { |l| find_locale_in_path(l, path)}.uniq.map(&:to_s)
57
+ begin
58
+ tokens = @i18n_root.to_s.split(/[:.]/)
59
+ translation = tokens.reduce(R18n::I18n.new(locales, path).t) { |a, e| a.send(e) }
60
+ raise ArgumentError if translation.is_a?(R18n::Untranslated)
61
+ translation
62
+ rescue
63
+ raise Lazier::Exceptions::MissingTranslation.new(locales, path)
73
64
  end
65
+ end
74
66
 
75
- # Find a locale file in a path.
76
- #
77
- # @param locale [String] The locale to find.
78
- # @param path [String] The path where look into.
79
- # @return [String|nil] The version of the locale found or `nil`, if nothing was found.
80
- def find_locale_in_path(locale, path)
81
- locale ? [locale, locale[0, 5], locale[0, 2]].select {|l| File.exists?("#{path}/#{l}.yml") }.first : nil
82
- end
67
+ # Validates locales for messages.
68
+ #
69
+ # @param locales [Array] The list of locales to validate. English is added as fallback.
70
+ # @param path [String] The path where look into.
71
+ # @return [Array] The list of valid locales.
72
+ def validate_locales(locales, path)
73
+ (locales + [ENV["LANG"], R18n::I18n.system_locale, "en"]).select { |l| find_locale_in_path(l, path) }.uniq.map(&:to_s)
74
+ end
75
+
76
+ # Find a locale file in a path.
77
+ #
78
+ # @param locale [String] The locale to find.
79
+ # @param path [String] The path where look into.
80
+ # @return [String|nil] The version of the locale found or `nil`, if nothing was found.
81
+ def find_locale_in_path(locale, path)
82
+ locale ? [locale, locale[0, 5], locale[0, 2]].select { |l| File.exist?("#{path}/#{l}.yml") }.first : nil
83
+ end
83
84
  end
84
- end
85
+ end
data/lib/lazier/math.rb CHANGED
@@ -28,4 +28,4 @@ module Lazier
28
28
  end
29
29
  end
30
30
  end
31
- end
31
+ end
data/lib/lazier/object.rb CHANGED
@@ -31,24 +31,36 @@ module Lazier
31
31
  # Checks if the object is a valid integer.
32
32
  #
33
33
  # @return [Boolean] `true` is a valid integer, `false` otherwise.
34
- def is_integer?
35
- is_a?(::Integer) || is_a?(::TrueClass) || !self || normalize_number =~ ::Lazier::Object::INTEGER_MATCHER
34
+ def integer?
35
+ numeric?(Integer, ::Lazier::Object::INTEGER_MATCHER)
36
36
  end
37
+ alias_method :is_integer?, :integer?
37
38
 
38
39
  # Checks if the object is a valid float.
39
40
  #
40
41
  # @return [Boolean] `true` is a valid float, `false` otherwise.
41
- def is_float?
42
- is_a?(::Numeric) || is_a?(::TrueClass) || !self || normalize_number =~ ::Lazier::Object::FLOAT_MATCHER
42
+ def float?
43
+ numeric?(Numeric, ::Lazier::Object::FLOAT_MATCHER)
43
44
  end
44
- alias :is_number? :is_float?
45
+ alias_method :number?, :float?
46
+ alias_method :is_float?, :float?
47
+ alias_method :is_number?, :float?
48
+
49
+ # Checks if the object is of a numeric class of matches a numeric string expression.
50
+ #
51
+ # @return [Boolean] `true` is a valid numeric object, `false` otherwise.
52
+ def numeric?(klass = Integer, matcher = ::Lazier::Object::INTEGER_MATCHER)
53
+ is_a?(klass) || is_a?(::TrueClass) || !self || normalize_number =~ matcher
54
+ end
55
+ alias_method :is_numeric?, :numeric?
45
56
 
46
57
  # Checks if the object is a valid boolean value.
47
58
  #
48
59
  # @return [Boolean] `true` is a valid boolean value, `false` otherwise.
49
- def is_boolean?
60
+ def boolean?
50
61
  is_a?(::TrueClass) || !self || to_s =~ ::Lazier::Object::BOOLEAN_MATCHER
51
62
  end
63
+ alias_method :is_boolean?, :boolean?
52
64
 
53
65
  # Sends a method to the object. If the objects doesn't not respond to the method, it returns `nil` instead of raising an exception.
54
66
  #
@@ -76,7 +88,11 @@ module Lazier
76
88
  # @param stringifier [Symbol] The method used to convert the object to a string. *Ignored if a block is passed.*
77
89
  # @return [String] The string representation of the object.
78
90
  def ensure_string(default_value = "", stringifier = :to_s)
79
- !nil? ? (block_given? ? yield(self, default_value) : send(stringifier)) : default_value
91
+ if is_a?(NilClass)
92
+ default_value
93
+ else
94
+ block_given? ? yield(self, default_value) : send(stringifier)
95
+ end
80
96
  end
81
97
 
82
98
  # Makes sure that the object is an array. For non array objects, return a single element array containing the object.
@@ -89,44 +105,41 @@ module Lazier
89
105
  # @param block [Proc] A block to sanitize entries. It must accept the value as unique argument.
90
106
  # @return [Array] If the object is an array, then the object itself, a single element array containing the object otherwise.
91
107
  def ensure_array(default_value = nil, uniq = false, compact = false, flatten = false, sanitizer = nil, &block)
92
- rv = is_a?(::Array) ? dup : (default_value || (self.is_a?(NilClass) ? [] : [self]))
108
+ rv =
109
+ if is_a?(::Array)
110
+ dup
111
+ else
112
+ default_value || (self.is_a?(NilClass) ? [] : [self])
113
+ end
114
+
93
115
  rv = manipulate_array(rv, uniq, compact, flatten).map(&(block || sanitizer)) if block_given? || sanitizer
94
116
  manipulate_array(rv, uniq, compact, flatten)
95
117
  end
96
118
 
97
119
  # Makes sure that the object is an hash. For non hash objects, return an hash basing on the `default_value` parameter.
98
120
  #
99
- # @param access [Symbol|NilClass] The requested access for the keys of the returned object. Can be `:strings`, `:symbols` or `indifferent`. If `nil` the keys are not modified.
100
- # @param default_value [Hash|String|Symbol|NilClass] The default value to use. If it is an `Hash`, it is returned as value otherwise it is used to build as a key to build an hash with the current object as only value (everything but strings and symbols are mapped to `key`). Passing `nil` is equal to pass an empty Hash.
101
- # @param sanitizer [Symbol|nil] If not `nil`, the method to use to sanitize values of the hash. *Ignored if a block is present.*
121
+ # @param access [Symbol|NilClass] The requested access for the keys of the returned object. Can be `:strings`, `:symbols` or `indifferent`.
122
+ # If `nil` the keys are not modified.
123
+ # @param default_value [Hash|String|Symbol|NilClass] The default value to use. If it is an `Hash`, it is returned as value otherwise it is used to build
124
+ # as a key to build an hash with the current object as only value (everything but strings and symbols are mapped to `key`).
125
+ # Passing `nil` is equal to pass an empty Hash.
126
+ # @param sanitizer [Symbol|nil] If not `nil`, the method to use to sanitize values of the hash. *Ignored if `block` is present.*
127
+ # @param block [Proc] A block to sanitize entries. It must accept the value as unique argument.
102
128
  # @return [Hash] If the object is an hash, then the object itself, a hash with the object as single value otherwise.
103
- def ensure_hash(access = nil, default_value = nil, sanitizer = nil)
104
- default_value = {} if default_value.nil?
129
+ def ensure_hash(access = nil, default_value = nil, sanitizer = nil, &block)
130
+ default_value = {} if default_value.is_a?(NilClass)
105
131
 
106
- rv = if is_a?(::Hash) then
107
- self
108
- elsif default_value.is_a?(::Hash) then
109
- default_value
110
- else
111
- key = default_value.is_a?(::String) || default_value.is_a?(::Symbol) ? default_value : :key
112
- {key => self}
113
- end
132
+ rv = convert_to_hash(default_value)
133
+ rv = sanitize_hash(rv, sanitizer, block) if block || sanitizer
114
134
 
115
- if block_given? || sanitizer then
116
- rv = rv.reduce({}) {|h, (k, v)|
117
- h[k] = block_given? ? yield(v) : v.send(sanitizer)
118
- h
119
- }
120
- end
121
-
122
- rv.respond_to?(:ensure_access) ? rv.ensure_access(access) :rv
135
+ rv.respond_to?(:ensure_access) ? rv.ensure_access(access) : rv
123
136
  end
124
137
 
125
138
  # Converts the object to a boolean.
126
139
  #
127
140
  # @return [Boolean] The boolean representation of the object.
128
141
  def to_boolean
129
- is_a?(TrueClass) || self == 1.0 || self == 1 || !!(ensure_string =~ ::Lazier::Object::BOOLEAN_TRUE_MATCHER) || false
142
+ is_a?(TrueClass) || to_integer == 1 || ::Lazier::Object::BOOLEAN_TRUE_MATCHER.match(ensure_string).is_a?(MatchData)
130
143
  end
131
144
 
132
145
  # Converts the object to a integer.
@@ -142,7 +155,11 @@ module Lazier
142
155
  # @param default_value [Float] The value to return if the conversion is not possible.
143
156
  # @return [Float] The float representation of the object.
144
157
  def to_float(default_value = 0.0)
145
- is_float? ? ::Kernel.Float(is_a?(::Numeric) ? self : normalize_number) : default_value
158
+ if is_float?
159
+ ::Kernel.Float(is_a?(::Numeric) ? self : normalize_number)
160
+ else
161
+ default_value
162
+ end
146
163
  end
147
164
 
148
165
  # Returns the rounded float representaton of the object.
@@ -162,15 +179,14 @@ module Lazier
162
179
  # @param k_separator [String] The string to use as thousands separator.
163
180
  # @return [String] The string representation of the object.
164
181
  def format_number(precision = nil, decimal_separator = nil, add_string = nil, k_separator = nil)
165
- if is_number? then
182
+ if is_number?
166
183
  settings = ::Lazier.settings.format_number
167
184
  add_string ||= settings[:add_string]
168
185
 
169
- rv = ("%0.#{[precision || settings[:precision], 0].max}f" % to_float).split(".")
186
+ rv = format("%0.#{[precision || settings[:precision], 0].max}f", to_float).split(".")
170
187
  rv[0].gsub!(/(\d)(?=(\d{3})+(?!\d))/, "\\1#{k_separator || settings[:k_separator]}")
171
188
  rv = rv.join(decimal_separator || settings[:decimal_separator])
172
- rv += " #{add_string}" if add_string
173
- rv
189
+ add_string ? rv + " #{add_string}" : rv
174
190
  else
175
191
  nil
176
192
  end
@@ -194,7 +210,7 @@ module Lazier
194
210
  # @param formatter [Symbol] The method to use to format the label. Must accept the `length` and the `filler arguments.
195
211
  # @return [String] The object inspected and formatted.
196
212
  def indexize(length = 2, filler = "0", formatter = :rjust)
197
- self.ensure_string.send(formatter, length, filler)
213
+ ensure_string.send(formatter, length, filler)
198
214
  end
199
215
 
200
216
  # Inspects an object.
@@ -203,29 +219,59 @@ module Lazier
203
219
  # @param as_exception [Boolean] If raise an exception.
204
220
  # @return [String] The object inspected and formatted.
205
221
  def for_debug(format = :yaml, as_exception = true)
206
- rv = case format
207
- when :pretty_json
208
- ::JSON.pretty_generate(self)
209
- else
210
- send("to_#{format}")
211
- end
222
+ rv =
223
+ case format
224
+ when :pretty_json then ::JSON.pretty_generate(self)
225
+ else send("to_#{format}")
226
+ end
212
227
 
213
- as_exception ? raise(::Lazier::Exceptions::Debug.new(rv)) : rv
228
+ as_exception ? raise(::Lazier::Exceptions::Debug, rv) : rv
214
229
  end
215
230
 
216
231
  private
217
- # Performs manipulation on an array.
218
- #
219
- # @param rv [Array] The input array.
220
- # @param uniq [Boolean] If to remove duplicates from the array.
221
- # @param compact [Boolean] If to compact the array.
222
- # @param flatten [Boolean] If to flatten the array.
223
- # @return [Array] The manipulated array.
224
- def manipulate_array(rv, uniq, compact, flatten)
225
- rv = rv.flatten if flatten
226
- rv = rv.uniq if uniq
227
- rv = rv.compact if compact
228
- rv
232
+
233
+ # Performs manipulation on an array.
234
+ #
235
+ # @param rv [Array] The input array.
236
+ # @param uniq [Boolean] If to remove duplicates from the array.
237
+ # @param compact [Boolean] If to compact the array.
238
+ # @param flatten [Boolean] If to flatten the array.
239
+ # @return [Array] The manipulated array.
240
+ def manipulate_array(rv, uniq, compact, flatten)
241
+ rv = rv.flatten if flatten
242
+ rv = rv.uniq if uniq
243
+ rv = rv.compact if compact
244
+ rv
245
+ end
246
+
247
+ # Converts the object to a hash.
248
+ #
249
+ # @param default_value [Hash|String|Symbol|NilClass] The default value to use. If it is an `Hash`, it is returned as value otherwise it is used to build
250
+ # as a key to build an hash with the current object as only value (everything but strings and symbols are mapped to `key`).
251
+ # Passing `nil` is equal to pass an empty Hash.
252
+ # @return [Hash] An hash.
253
+ def convert_to_hash(default_value)
254
+ if is_a?(::Hash)
255
+ self
256
+ elsif default_value.is_a?(::Hash)
257
+ default_value
258
+ else
259
+ key = default_value.is_a?(::String) || default_value.is_a?(::Symbol) ? default_value : :key
260
+ {key => self}
229
261
  end
262
+ end
263
+
264
+ # Sanitizes an hash
265
+ #
266
+ # @param hash [Hash] The hash to sanitize.
267
+ # @param sanitizer [Symbol|nil] If not `nil`, the method to use to sanitize values of the hash. *Ignored if `block` is present.*
268
+ # @param block [Proc] A block to sanitize entries. It must accept the value as unique argument.
269
+ # @return [Hash] The sanitized hash.
270
+ def sanitize_hash(hash, sanitizer, block)
271
+ hash.reduce({}) { |h, (k, v)|
272
+ h[k] = block ? block.call(v) : v.send(sanitizer)
273
+ h
274
+ }
275
+ end
230
276
  end
231
- end
277
+ end
@@ -21,4 +21,4 @@ module Lazier
21
21
  each_filename.to_a
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -66,7 +66,9 @@ module Lazier
66
66
  # @param k_separator [String] The string to use as thousands separator.
67
67
  # @return [Hash] The new formatters.
68
68
  def setup_format_number(precision = 2, decimal_separator = ".", add_string = nil, k_separator = ",")
69
- @format_number = ::HashWithIndifferentAccess.new({precision: precision, decimal_separator: decimal_separator, add_string: add_string, k_separator: k_separator})
69
+ @format_number = ::HashWithIndifferentAccess.new(
70
+ precision: precision, decimal_separator: decimal_separator, add_string: add_string, k_separator: k_separator
71
+ )
70
72
  end
71
73
 
72
74
  # Setups strings representation of booleans.
@@ -105,7 +107,7 @@ module Lazier
105
107
  # @param short_days [Array] The abbreviated string representation of days.
106
108
  # @return [Hash] The new representations.
107
109
  def setup_date_names(long_months = nil, short_months = nil, long_days = nil, short_days = nil)
108
- definitions = self.i18n.date
110
+ definitions = i18n.date
109
111
 
110
112
  @date_names = {
111
113
  long_months: long_months.ensure(definitions.long_months),
data/lib/lazier/string.rb CHANGED
@@ -27,7 +27,7 @@ module Lazier
27
27
  # @return [String] The string with any invalid UTF-8 sequences replaced.
28
28
  def ensure_valid_utf8(replacement = "")
29
29
  # This odd line is because if need to specify a different encoding (without losing infos) to replace invalid bytes and then we go back to utf-8
30
- !defined?(JRUBY_VERSION) ? encode("utf-16", invalid: :replace, undef: :replace, replace: replacement).encode("utf-8") : raise(RuntimeError.new("Sorry, Lazier::String#ensure_valid_utf8 is not available on JRuby."))
30
+ encode("utf-16", invalid: :replace, undef: :replace, replace: replacement).encode("utf-8")
31
31
  end
32
32
 
33
33
  # Returns the tagged version of a string.
@@ -66,11 +66,11 @@ module Lazier
66
66
  # @param pattern [String|Regexp] The pattern to use.
67
67
  # @return [Array] An array of tokens.
68
68
  def split_tokens(no_blanks = true, strip = true, uniq = false, pattern = /\s*,\s*/)
69
- rv = self.split(pattern)
69
+ rv = split(pattern)
70
70
  rv.map!(&:strip) if strip
71
71
  rv.select!(&:present?) if no_blanks
72
72
  rv.uniq! if uniq
73
73
  rv
74
74
  end
75
75
  end
76
- end
76
+ end
@@ -16,7 +16,7 @@ module Lazier
16
16
  MINOR = 5
17
17
 
18
18
  # The patch version.
19
- PATCH = 1
19
+ PATCH = 2
20
20
 
21
21
  # The current version of lazier.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -204,9 +204,9 @@ describe Lazier::TimeZone do
204
204
  let(:zone_without_dst) { ::ActiveSupport::TimeZone["International Date Line West"] }
205
205
 
206
206
  before(:all) do
207
+ ::Lazier.load!
207
208
  ::Lazier::Settings.instance(true)
208
209
  ::Lazier::Settings.instance.i18n = :en
209
- ::Lazier.load!
210
210
  end
211
211
 
212
212
  describe ".rationalize_offset" do