core_ext 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/lib/core_ext/configurable.rb +1 -1
- data/lib/core_ext/deprecation.rb +2 -2
- data/lib/core_ext/deprecation/behaviors.rb +1 -8
- data/lib/core_ext/inflector.rb +1 -1
- data/lib/core_ext/time_with_zone.rb +1 -1
- data/lib/core_ext/time_zone.rb +2 -1
- data/lib/core_ext/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65bef674a3f30a7d453c6daf9c001da0ad8ce670
|
4
|
+
data.tar.gz: 4091487a2288aeeb53d9a65f16b64bd91e71962a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4eedaeea00537d6013ce8a4e4176b219bc20894776a27241c6781c611382f92753923d75604ca6d2d7bcb6748dce6d2580993aeceb763b209601d4e846bd95e
|
7
|
+
data.tar.gz: 8c7e8c31d381fcfa7511f98a5764fed0fe449bfc1b524cd3968c3766ff05f59751d5686b51f016ff79f76f9475fc56b10f9a12bcf4fd8e98c15c97e430854aad
|
data/lib/core_ext/deprecation.rb
CHANGED
@@ -4,12 +4,12 @@ module CoreExt
|
|
4
4
|
# \Deprecation specifies the API used by Rails to deprecate methods, instance
|
5
5
|
# variables, objects and constants.
|
6
6
|
class Deprecation
|
7
|
-
#
|
7
|
+
# core_ext.rb sets an autoload for CoreExt::Deprecation.
|
8
8
|
#
|
9
9
|
# If these requires were at the top of the file the constant would not be
|
10
10
|
# defined by the time their files were loaded. Since some of them reopen
|
11
11
|
# CoreExt::Deprecation its autoload would be triggered, resulting in
|
12
|
-
# a circular require warning for
|
12
|
+
# a circular require warning for core_ext/deprecation.rb.
|
13
13
|
#
|
14
14
|
# So, we define the constant first, and load dependencies later.
|
15
15
|
require 'core_ext/deprecation/instance_delegator'
|
@@ -21,18 +21,13 @@ module CoreExt
|
|
21
21
|
if defined?(Rails.logger) && Rails.logger
|
22
22
|
Rails.logger
|
23
23
|
else
|
24
|
-
require '
|
24
|
+
require 'core_ext/logger'
|
25
25
|
CoreExt::Logger.new($stderr)
|
26
26
|
end
|
27
27
|
logger.warn message
|
28
28
|
logger.debug callstack.join("\n ") if debug
|
29
29
|
},
|
30
30
|
|
31
|
-
notify: ->(message, callstack) {
|
32
|
-
CoreExt::Notifications.instrument("deprecation.rails",
|
33
|
-
:message => message, :callstack => callstack)
|
34
|
-
},
|
35
|
-
|
36
31
|
silence: ->(message, callstack) {},
|
37
32
|
}
|
38
33
|
|
@@ -43,7 +38,6 @@ module CoreExt
|
|
43
38
|
# [+raise+] Raise <tt>CoreExt::DeprecationException</tt>.
|
44
39
|
# [+stderr+] Log all deprecation warnings to +$stderr+.
|
45
40
|
# [+log+] Log all deprecation warnings to +Rails.logger+.
|
46
|
-
# [+notify+] Use +CoreExt::Notifications+ to notify +deprecation.rails+.
|
47
41
|
# [+silence+] Do nothing.
|
48
42
|
#
|
49
43
|
# Setting behaviors only affects deprecations that happen after boot time.
|
@@ -65,7 +59,6 @@ module CoreExt
|
|
65
59
|
# [+raise+] Raise <tt>CoreExt::DeprecationException</tt>.
|
66
60
|
# [+stderr+] Log all deprecation warnings to +$stderr+.
|
67
61
|
# [+log+] Log all deprecation warnings to +Rails.logger+.
|
68
|
-
# [+notify+] Use +CoreExt::Notifications+ to notify +deprecation.rails+.
|
69
62
|
# [+silence+] Do nothing.
|
70
63
|
#
|
71
64
|
# Setting behaviors only affects deprecations that happen after boot time.
|
data/lib/core_ext/inflector.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# in case
|
1
|
+
# in case core_ext/inflector is required without the rest of core_ext
|
2
2
|
require 'core_ext/inflector/inflections'
|
3
3
|
require 'core_ext/inflector/transliterate'
|
4
4
|
require 'core_ext/inflector/methods'
|
@@ -199,7 +199,7 @@ module CoreExt
|
|
199
199
|
# Accepts an optional <tt>format</tt>:
|
200
200
|
# * <tt>:default</tt> - default value, mimics Ruby Time#to_s format.
|
201
201
|
# * <tt>:db</tt> - format outputs time in UTC :db time. See Time#to_formatted_s(:db).
|
202
|
-
# * Any key in <tt>Time::DATE_FORMATS</tt> can be used. See
|
202
|
+
# * Any key in <tt>Time::DATE_FORMATS</tt> can be used. See core_ext/core_ext/time/conversions.rb.
|
203
203
|
def to_s(format = :default)
|
204
204
|
if format == :db
|
205
205
|
utc.to_s(format)
|
data/lib/core_ext/time_zone.rb
CHANGED
@@ -418,8 +418,9 @@ module CoreExt
|
|
418
418
|
|
419
419
|
# Available so that TimeZone instances respond like TZInfo::Timezone
|
420
420
|
# instances.
|
421
|
+
# https://github.com/tzinfo/tzinfo/issues/32
|
421
422
|
def period_for_local(time, dst=true)
|
422
|
-
tzinfo.period_for_local(time, dst)
|
423
|
+
tzinfo.period_for_local(time, dst) { |results| results.first }
|
423
424
|
end
|
424
425
|
|
425
426
|
def periods_for_local(time) #:nodoc:
|
data/lib/core_ext/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: core_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Panachi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|