lazier 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.travis-gemfile +2 -2
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +6 -6
  5. data/README.md +1 -1
  6. data/doc/Lazier.html +185 -70
  7. data/doc/Lazier/Boolean.html +5 -5
  8. data/doc/Lazier/Configuration.html +78 -16
  9. data/doc/Lazier/DateTime.html +13 -12
  10. data/doc/Lazier/DateTime/ClassMethods.html +6 -6
  11. data/doc/Lazier/Exceptions.html +3 -3
  12. data/doc/Lazier/Exceptions/Debug.html +3 -3
  13. data/doc/Lazier/Exceptions/MissingTranslation.html +9 -9
  14. data/doc/Lazier/Exceptions/TranslationExceptionHandler.html +73 -9
  15. data/doc/Lazier/Hash.html +7 -7
  16. data/doc/Lazier/I18n.html +41 -41
  17. data/doc/Lazier/Math.html +4 -4
  18. data/doc/Lazier/Math/ClassMethods.html +7 -7
  19. data/doc/Lazier/Object.html +29 -26
  20. data/doc/Lazier/Pathname.html +11 -12
  21. data/doc/Lazier/Settings.html +63 -63
  22. data/doc/Lazier/String.html +122 -21
  23. data/doc/Lazier/TimeZone.html +128 -32
  24. data/doc/Lazier/TimeZone/ClassMethods.html +5 -5
  25. data/doc/Lazier/Version.html +4 -4
  26. data/doc/_index.html +4 -4
  27. data/doc/class_list.html +5 -1
  28. data/doc/file.README.html +4 -4
  29. data/doc/file_list.html +5 -1
  30. data/doc/frames.html +1 -1
  31. data/doc/index.html +4 -4
  32. data/doc/js/full_list.js +4 -1
  33. data/doc/method_list.html +91 -81
  34. data/doc/top-level-namespace.html +3 -3
  35. data/lib/lazier.rb +18 -17
  36. data/lib/lazier/boolean.rb +1 -1
  37. data/lib/lazier/configuration.rb +6 -6
  38. data/lib/lazier/datetime.rb +11 -11
  39. data/lib/lazier/exceptions.rb +7 -2
  40. data/lib/lazier/hash.rb +4 -4
  41. data/lib/lazier/i18n.rb +7 -7
  42. data/lib/lazier/math.rb +3 -3
  43. data/lib/lazier/object.rb +17 -15
  44. data/lib/lazier/pathname.rb +3 -5
  45. data/lib/lazier/settings.rb +10 -10
  46. data/lib/lazier/string.rb +10 -1
  47. data/lib/lazier/timezone.rb +23 -25
  48. data/lib/lazier/version.rb +1 -1
  49. data/spec/lazier/string_spec.rb +14 -0
  50. data/spec/spec_helper.rb +1 -8
  51. metadata +2 -2
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.4
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Thu Oct 2 10:38:44 2014 by
106
+ Generated on Sun Nov 2 11:08:44 2014 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.7.4 (ruby-2.1.3).
108
+ 0.8.7.6 (ruby-2.1.3).
109
109
  </div>
110
110
 
111
111
  </body>
@@ -3,6 +3,8 @@
3
3
  # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
4
4
  #
5
5
 
6
+ # PI: Ignore flog on this file.
7
+
6
8
  require(RUBY_ENGINE != "jruby" ? "oj" : "json")
7
9
  require "English"
8
10
  require "tzinfo"
@@ -43,15 +45,14 @@ module Lazier
43
45
  # Loads the extensions.
44
46
  #
45
47
  # @param what [Array] The modules to load. Valid values are:
46
- #
47
- # @option object Extensions for all objects.
48
- # @option boolean Extensions for boolean values.
49
- # @option string Extensions for strings.
50
- # @option hash Extensions for hashs.
51
- # @option hash_method_access Extensions for hash to allow method access. Not included by default.
52
- # @option datetime Extensions date and time objects.
53
- # @option math Extensions for Math module.
54
- # @option pathname Extensions for path objects.
48
+ # @option object Extensions for all objects.
49
+ # @option boolean Extensions for boolean values.
50
+ # @option string Extensions for strings.
51
+ # @option hash Extensions for hashs.
52
+ # @option hash_method_access Extensions for hash to allow method access. Not included by default.
53
+ # @option datetime Extensions date and time objects.
54
+ # @option math Extensions for Math module.
55
+ # @option pathname Extensions for path objects.
55
56
  # @return [Settings] The settings for the extensions.
56
57
  def self.load!(*what)
57
58
  valid_modules = [:object, :boolean, :string, :hash, :datetime, :math, :pathname]
@@ -62,13 +63,13 @@ module Lazier
62
63
  ::Lazier::Settings.instance
63
64
  end
64
65
 
65
- # Loads Object extensions.
66
+ # Loads `Object` extensions.
66
67
  def self.load_object
67
68
  Lazier.load_boolean
68
69
  perform_load(:object, ::Object, ::Lazier::Object)
69
70
  end
70
71
 
71
- # Loads Boolean extensions.
72
+ # Loads `Boolean` extensions.
72
73
  def self.load_boolean
73
74
  perform_load(:boolean) do
74
75
  [::TrueClass, ::FalseClass].each do |klass|
@@ -80,12 +81,12 @@ module Lazier
80
81
  end
81
82
  end
82
83
 
83
- # Loads String extensions.
84
+ # Loads `String` extensions.
84
85
  def self.load_string
85
86
  perform_load(:string, ::String, ::Lazier::String)
86
87
  end
87
88
 
88
- # Loads Hash extensions.
89
+ # Loads `Hash` extensions.
89
90
  def self.load_hash
90
91
  Lazier.load_object
91
92
 
@@ -95,7 +96,7 @@ module Lazier
95
96
  end
96
97
  end
97
98
 
98
- # Loads DateTime extensions.
99
+ # Loads `DateTime` extensions.
99
100
  def self.load_datetime
100
101
  Lazier.load_object
101
102
 
@@ -108,13 +109,13 @@ module Lazier
108
109
  end
109
110
  end
110
111
 
111
- # Loads Math extensions.
112
+ # Loads `Math` extensions.
112
113
  def self.load_math
113
114
  Lazier.load_object
114
115
  perform_load(:math, ::Math, ::Lazier::Math)
115
116
  end
116
117
 
117
- # Loads Pathname extensions.
118
+ # Loads `Pathname` extensions.
118
119
  def self.load_pathname
119
120
  perform_load(:pathname, ::Pathname, ::Lazier::Pathname)
120
121
  end
@@ -153,7 +154,7 @@ module Lazier
153
154
  # Measure the time in milliseconds required to execute the given block.
154
155
  #
155
156
  # @param message [String|NilClass] An optional message (see return value).
156
- # @param precision [Fixnum] The precision for the message (see return value)..
157
+ # @param precision [Fixnum] The precision for the message (see return value).
157
158
  # @param block [Proc] The block to evaluate.
158
159
  # @return [Float|String] If a `message` is provided, then the message itself plus the duration under parenthesis will be returned,
159
160
  # otherwise the duration alone as a number.
@@ -8,7 +8,7 @@ module Lazier
8
8
  module Boolean
9
9
  extend ::ActiveSupport::Concern
10
10
 
11
- # Converts the boolean to an integer.
11
+ # Converts the boolean to a integer.
12
12
  #
13
13
  # @return [Fixnum] `1` for `true`, `0` for `false`.
14
14
  def to_i
@@ -7,22 +7,22 @@ module Lazier
7
7
  # A configuration class to set properties.
8
8
  class Configuration < Hashie::Dash
9
9
  # Initializes a new configuration object.
10
+ # @see Hash#initialize
10
11
  #
11
12
  # @param attributes [Hash] The initial values of properties of this configuration.
13
+ # @param block [Proc] A block to use for default values.
12
14
  def initialize(attributes = {}, &block)
13
15
  @i18n = Lazier::I18n.instance
14
16
  super(attributes, &block)
15
17
  end
16
18
 
17
19
  # Defines a property on the configuration.
18
- # Options are as follows:
19
- #
20
- # * :default - Specify a default value for this property.
21
- # * :required - Specify the value as required for this property, to raise an error if a value is unset in a new or existing configuration.
22
- # * :readonly - Specify if the property is readonly, which means that it can only defined during creation of the configuration.
23
- #
20
+
24
21
  # @param name [String|Symbol] The new property name.
25
22
  # @param options [Hash] The options for the property.
23
+ # @option options [Boolean] :default Specify a default value for this property.
24
+ # @option options [Boolean] :required Specify the value as required for this property, to raise an error if a value is unset in a new or existing configuration.
25
+ # @option options [Boolean] :readonly Specify if the property is readonly, which means that it can only defined during creation of the configuration.
26
26
  def self.property(name, options = {})
27
27
  super(name, options)
28
28
 
@@ -47,8 +47,8 @@ module Lazier
47
47
  #
48
48
  # @param offset [Fixnum] The width of the range.
49
49
  # @param also_future [Boolean] If return also future years.
50
- # @param reference [Fixnum] The ending (or middle, if `also_future` is `true`) value of the range. Defaults to the current year.
51
- # @param as_objects [Boolean] If to return years in hashes with `:value` and `label` keys.
50
+ # @param reference [Fixnum|NilClass] The ending (or middle, if `also_future` is `true`) value of the range. Defaults to the current year.
51
+ # @param as_objects [Boolean] Whether to return years in hashes with `:value` and `label` keys.
52
52
  # @return [Array] A range of years. Every entry is
53
53
  def years(offset: 10, also_future: true, reference: nil, as_objects: false)
54
54
  y = reference || ::Date.today.year
@@ -80,7 +80,7 @@ module Lazier
80
80
  # Returns the Easter (according to Gregorian calendar) date for the year.
81
81
  # @see http://en.wikipedia.org/wiki/Computus#Anonymous_Gregorian_algorithm
82
82
  #
83
- # @param year [Fixnum] The year to compute the date for. Defaults to the current year.
83
+ # @param year [Fixnum|NilClass] The year to compute the date for. Defaults to the current year.
84
84
  # @return [Date] The Easter date for the year.
85
85
  def easter(year = nil)
86
86
  year = ::Date.today.year unless year.integer?
@@ -138,20 +138,20 @@ module Lazier
138
138
 
139
139
  # Returns the number of months passed between the beginning of the base year and the current date.
140
140
  #
141
- # ```ruby
142
- # DateTime.civil(2013, 6, 1).in_months(2011)
143
- # # => 18
144
- # ```
141
+ # Example:
145
142
  #
146
- # @param base [DateTime] The base year to start computation from. Default to current year.
143
+ # DateTime.civil(2013, 6, 1).in_months(2011)
144
+ # # => 18
145
+ #
146
+ # @param base [DateTime|NilClass] The base year to start computation from. Default to current year.
147
147
  # @return [Fixnum] Returns the number of months passed between the beginning of the base year and the current date.
148
148
  def months_since_year(base = nil)
149
149
  (year - (base || ::Date.today.year)) * 12 + month
150
150
  end
151
151
 
152
- # Returns the current month number with leading 0.
152
+ # Returns the current month number with a leading zero if needed.
153
153
  #
154
- # @return [String] The current month number with leading 0.
154
+ # @return [String] The current month number with leading zero if needed.
155
155
  def padded_month
156
156
  month.indexize
157
157
  end
@@ -159,7 +159,7 @@ module Lazier
159
159
  # Formats a datetime, eventually looking up also custom formats and/or moving to the current timezone.
160
160
  # @see Settings#setup_date_formats
161
161
  #
162
- # @param format [String] A format or a custom format name to use for formatting.
162
+ # @param format [String|NilClass] A format or a custom format name to use for formatting.
163
163
  # @param custom [Boolean] Whether to use custom formats.
164
164
  # @param change_time_zone [Boolean] Whether to move the date to the current timezone.
165
165
  # @return [String] The formatted date.
@@ -12,7 +12,12 @@ module Lazier
12
12
 
13
13
  # This is the handler for the core I18n gem.
14
14
  class TranslationExceptionHandler < ::I18n::ExceptionHandler
15
- # :nodoc:
15
+ # Implements the ExceptionHandler interface for I18n.
16
+ #
17
+ # @param exception [Exception] The error to raise.
18
+ # @param locale [String|Symbol] The locale that was requested.
19
+ # @param key [String|Symbol] The key that was requested.
20
+ # @param options [Hash] The options passed to the translation.
16
21
  def call(exception, locale, key, options)
17
22
  exception.is_a?(::I18n::MissingTranslation) ? raise(exception.to_exception) : super
18
23
  end
@@ -23,7 +28,7 @@ module Lazier
23
28
  # Creates a new missing translation exception.
24
29
  #
25
30
  # @param locale [Array] The locale that was requested to use.
26
- # @param message [String] The message that was requested to translate.
31
+ # @param message [String|NilClass] The message that was requested to translate.
27
32
  def initialize(locale, message = nil)
28
33
  locale, message = locale if message.nil?
29
34
  super("Unable to load the translation \"#{message}\" for the locale \"#{locale}\".")
@@ -4,7 +4,7 @@
4
4
  #
5
5
 
6
6
  module Lazier
7
- # Extensions for Hash objects.
7
+ # Extensions for `Hash` objects.
8
8
  module Hash
9
9
  # The supported accesses for #ensure_access
10
10
  VALID_ACCESSES = {
@@ -18,7 +18,7 @@ module Lazier
18
18
 
19
19
  # Returns a new hash, removing all keys which values are blank.
20
20
  #
21
- # @param validator [Proc], if present all the keys which evaluates to true will be removed. Otherwise all blank values will be removed.
21
+ # @param validator [Proc] If present all the keys which evaluates to true will be removed. Otherwise all blank values will be removed.
22
22
  # @return [Hash] The hash with all blank values removed.
23
23
  def compact(&validator)
24
24
  dup.compact!(&validator)
@@ -26,7 +26,7 @@ module Lazier
26
26
 
27
27
  # Compacts the current hash, removing all keys which values are blank.
28
28
  #
29
- # @param validator [Proc], if present all the keys which evaluates to true will be removed. Otherwise all blank values will be removed.
29
+ # @param validator [Proc] If present all the keys which evaluates to true will be removed. Otherwise all blank values will be removed.
30
30
  def compact!(&validator)
31
31
  validator ||= ->(_, v) { v.blank? }
32
32
  reject!(&validator)
@@ -34,7 +34,7 @@ module Lazier
34
34
 
35
35
  # Makes sure that the keys of the hash are accessible in the desired way.
36
36
  #
37
- # @param accesses [Array] The requested access for the keys. Can be `:strings`, `:symbols` or `:indifferent`. If `nil` the keys are not modified.
37
+ # @param accesses [Array] The requested access for the keys. Can be `:dotted`, `:strings`, `:symbols` or `:indifferent`. If `nil` the keys are not modified.
38
38
  # @return [Hash] The current hash with keys modified.
39
39
  def ensure_access(*accesses)
40
40
  methods = accesses.ensure_array(compact: true, no_duplicates: true, flatten: true) { |m| VALID_ACCESSES[m.ensure_string.to_sym] }.compact
@@ -23,10 +23,10 @@ module Lazier
23
23
 
24
24
  # Returns the singleton instance of the settings.
25
25
  #
26
- # @param locale [Symbol] The locale to use for translations. Default is the current system locale.
26
+ # @param locale [Symbol|NilClass] The locale to use for translations. Default is the current system locale.
27
27
  # @param root [Symbol] The root level of the translation.
28
- # @param path [String] The path where the translations are stored.
29
- # @param force [Boolean] If to force recreation of the instance.
28
+ # @param path [String|NilClass] The path where the translations are stored.
29
+ # @param force [Boolean] Whether to force recreation of the instance.
30
30
  # @return [I18n] The singleton instance of the i18n.
31
31
  def self.instance(locale = nil, root: :lazier, path: nil, force: false)
32
32
  @instance = nil if force
@@ -35,9 +35,9 @@ module Lazier
35
35
 
36
36
  # Creates a new I18n object.
37
37
  #
38
- # @param locale [Symbol] The locale to use. Defaults to the current locale.
38
+ # @param locale [Symbol|NilClass] The locale to use. Defaults to the current locale.
39
39
  # @param root [Symbol] The root level of the translation.
40
- # @param path [String] The path where the translations are stored.
40
+ # @param path [String|NilClass] The path where the translations are stored.
41
41
  def initialize(locale = nil, root: :lazier, path: nil)
42
42
  Lazier.load_object
43
43
  path ||= Lazier::ROOT + "/locales"
@@ -57,7 +57,7 @@ module Lazier
57
57
 
58
58
  # Gets the list of available translation for a locale.
59
59
  #
60
- # @param locale [Symbol] The locale to list. Defaults to the current locale.
60
+ # @param locale [Symbol|NilClass] The locale to list. Defaults to the current locale.
61
61
  # @return [Hash] The available translations for the specified locale.
62
62
  def translations(locale = nil)
63
63
  locale ||= @locale
@@ -98,8 +98,8 @@ module Lazier
98
98
 
99
99
  # Localize a message in a specific locale.
100
100
  #
101
- # @param message [String|Symbol] The message to localize.
102
101
  # @param locale [String|Symbol] The new locale to use for localization.
102
+ # @param message [String|Symbol] The message to localize.
103
103
  # @param args [Array] Optional arguments to localize the message.
104
104
  # @return [String] The localized message.
105
105
  def translate_in_locale(locale, message, *args)
@@ -4,13 +4,13 @@
4
4
  #
5
5
 
6
6
  module Lazier
7
- # Utility methods for Math module.
7
+ # Utility methods for `Math` module.
8
8
  module Math
9
9
  extend ::ActiveSupport::Concern
10
10
 
11
11
  # General methods.
12
12
  module ClassMethods
13
- # Returns the minimum value in the arguments
13
+ # Returns the minimum value between the arguments.
14
14
  #
15
15
  # @param args [Array] A list of objects to compare (with the `<` operator).
16
16
  # @return [Object] The minimum value or `nil` (if the list is empty).
@@ -18,7 +18,7 @@ module Lazier
18
18
  args.ensure_array(default: [], no_duplicates: true, compact: true, flatten: true).min
19
19
  end
20
20
 
21
- # Returns the maximum value in the arguments
21
+ # Returns the maximum value between the arguments.
22
22
  #
23
23
  # @param args [Array] A list of objects to compare (with the `>` operator).
24
24
  # @return [Object] The maximum value or `nil` (if the list is empty).
@@ -93,10 +93,10 @@ module Lazier
93
93
  # Makes sure that the object is an array. For non array objects, return a single element array containing the object.
94
94
  #
95
95
  # @param default [Array|NilClass] The default array to use. If not specified, an array containing the object is returned.
96
- # @param no_duplicates [Boolean] If to remove duplicates from the array before sanitizing.
97
- # @param compact [Boolean] If to compact the array before sanitizing.
98
- # @param flatten [Boolean] If to flatten the array before sanitizing.
99
- # @param sanitizer [Symbol|nil] If not `nil`, the method to use to sanitize entries of the array. *Ignored if a block is present.*
96
+ # @param no_duplicates [Boolean] Whether to remove duplicates from the array before sanitizing.
97
+ # @param compact [Boolean] Whether to compact the array before sanitizing.
98
+ # @param flatten [Boolean] Whether to flatten the array before sanitizing.
99
+ # @param sanitizer [Symbol|NilClass] If not `nil`, the method to use to sanitize entries of the array. *Ignored if a block is present.*
100
100
  # @param block [Proc] A block to sanitize entries. It must accept the value as unique argument.
101
101
  # @return [Array] If the object is an array, then the object itself, a single element array containing the object otherwise.
102
102
  def ensure_array(default: nil, no_duplicates: false, compact: false, flatten: false, sanitizer: nil, &block)
@@ -119,7 +119,7 @@ module Lazier
119
119
  # @param default [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
120
120
  # as a key to build an hash with the current object as only value (everything but strings and symbols are mapped to `key`).
121
121
  # Passing `nil` is equal to pass an empty Hash.
122
- # @param sanitizer [Symbol|nil] If not `nil`, the method to use to sanitize values of the hash. *Ignored if `block` is present.*
122
+ # @param sanitizer [Symbol|NilClass] If not `nil`, the method to use to sanitize values of the hash. *Ignored if `block` is present.*
123
123
  # @param block [Proc] A block to sanitize entries. It must accept the value as unique argument.
124
124
  # @return [Hash] If the object is an hash, then the object itself, a hash with the object as single value otherwise.
125
125
  def ensure_hash(accesses: nil, default: {}, sanitizer: nil, &block)
@@ -184,11 +184,11 @@ module Lazier
184
184
  # Formats a number.
185
185
  # @see Settings#setup_format_number
186
186
  #
187
- # @param precision [Fixnum] The precision to show.
188
- # @param decimal_separator [String] The string to use as decimal separator.
189
- # @param add_string [String] The string to append to the number.
190
- # @param k_separator [String] The string to use as thousands separator.
191
- # @return [String] The string representation of the object.
187
+ # @param precision [Fixnum|NilClass] The precision to show.
188
+ # @param decimal_separator [String|NilClass] The string to use as decimal separator.
189
+ # @param add_string [String|NilClass] The string to append to the number.
190
+ # @param k_separator [String|NilClass] The string to use as thousands separator.
191
+ # @return [String|NilClass] The string representation of the object or `nil`, if the object is not a number.
192
192
  def format_number(precision: nil, decimal_separator: nil, add_string: nil, k_separator: nil)
193
193
  if number?
194
194
  settings = ::Lazier.settings.format_number
@@ -206,19 +206,21 @@ module Lazier
206
206
  # Formats a boolean.
207
207
  # @see Settings#setup_boolean_names
208
208
  #
209
- # @param true_name [String] The string representation of `true`. Defaults to `Yes`.
210
- # @param false_name [String] The string representation of `false`. Defaults to `No`.
209
+ # @param true_name [String|NilClass] The string representation of `true`. Defaults to `Yes`.
210
+ # @param false_name [String|NilClass] The string representation of `false`. Defaults to `No`.
211
211
  # @return [String] The string representation of the object.
212
212
  def format_boolean(true_name: nil, false_name: nil)
213
213
  settings = ::Lazier.settings.boolean_names
214
214
  to_boolean ? (true_name || settings[true]) : (false_name || settings[false])
215
215
  end
216
216
 
217
- # Prepares an object to be printed in list summaries, like `[01/04] Opening this...`.
217
+ # Prepares an object to be printed in list summaries, like
218
+ #
219
+ # [01/04] Opening this...
218
220
  #
219
221
  # @param length [Fixnum] The minimum length of the label.
220
- # @param filler [String] The minimum length of the label.
221
- # @param formatter [Symbol] The method to use to format the label. Must accept the `length` and the `filler arguments.
222
+ # @param filler [String] The character to use to fill the label.
223
+ # @param formatter [Symbol] The method to use to format the label. Must accept the `length` and the `filler` arguments.
222
224
  # @return [String] The object inspected and formatted.
223
225
  def indexize(length: 2, filler: "0", formatter: :rjust)
224
226
  ensure_string.send(formatter, length, filler)
@@ -4,16 +4,14 @@
4
4
  #
5
5
 
6
6
  module Lazier
7
- # Extensions for the Pathname class.
7
+ # Extensions for the `Pathname` class.
8
8
  module Pathname
9
9
  extend ::ActiveSupport::Concern
10
10
 
11
11
  # Returns all the components that are included in this path.
12
12
  #
13
- # ```ruby
14
- # Pathname.new("/usr/bin/ruby").components
15
- # # => ["usr", "bin", "ruby"]
16
- # ```
13
+ # Pathname.new("/usr/bin/ruby").components
14
+ # # => ["usr", "bin", "ruby"]
17
15
  #
18
16
  # @return [Array] A list of all components that are included in this path.
19
17
  def components
@@ -21,7 +21,7 @@ module Lazier
21
21
 
22
22
  # Returns the singleton instance of the settings.
23
23
  #
24
- # @param force [Boolean] If to force recreation of the instance.
24
+ # @param force [Boolean] Whether to force recreation of the instance.
25
25
  # @return [Settings] The singleton instance of the settings.
26
26
  def self.instance(force = false)
27
27
  @instance = nil if force
@@ -60,8 +60,8 @@ module Lazier
60
60
  # Setups strings representation of booleans.
61
61
  # @see Object#format_boolean
62
62
  #
63
- # @param true_name [String] The string representation of `true`. Defaults to `Yes`.
64
- # @param false_name [String] The string representation of `false`. Defaults to `No`.
63
+ # @param true_name [String|NilClass] The string representation of `true`. Defaults to `Yes`.
64
+ # @param false_name [String|NilClass] The string representation of `false`. Defaults to `No`.
65
65
  # @return [Hash] The new representations.
66
66
  def setup_boolean_names(true_name: nil, false_name: nil)
67
67
  names = i18n.translate("boolean")
@@ -71,8 +71,8 @@ module Lazier
71
71
  # Setups custom formats for dates and times.
72
72
  # @see DateTime#lstrftime
73
73
  #
74
- # @param formats [Hash] The format to add or replace.
75
- # @param replace [Boolean] If to discard current formats.
74
+ # @param formats [Hash|NilClass] The format to add or replace.
75
+ # @param replace [Boolean] Whether to discard current formats.
76
76
  # @return [Hash] The new formats.
77
77
  def setup_date_formats(formats = nil, replace = false)
78
78
  @date_formats = HashWithIndifferentAccess.new if replace || !@date_formats
@@ -87,12 +87,12 @@ module Lazier
87
87
  # Setups strings representation of days and months.
88
88
  # @see DateTime::ClassMethods#days
89
89
  # @see DateTime::ClassMethods#months
90
- # @see DateTime#lstrftime
90
+ # @see Lazier::DateTime#format
91
91
  #
92
- # @param long_months [Array] The string representation of months.
93
- # @param short_months [Array] The abbreviated string representation of months.
94
- # @param long_days [Array] The string representation of days.
95
- # @param short_days [Array] The abbreviated string representation of days.
92
+ # @param long_months [Array|NilClass] The string representation of months.
93
+ # @param short_months [Array|NilClass] The abbreviated string representation of months.
94
+ # @param long_days [Array|NilClass] The string representation of days.
95
+ # @param short_days [Array|NilClass] The abbreviated string representation of days.
96
96
  # @return [Hash] The new representations.
97
97
  def setup_date_names(long_months: nil, short_months: nil, long_days: nil, short_days: nil)
98
98
  definitions = prepare_definitions