class2 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes +6 -0
- data/README.md +0 -2
- data/lib/class2/autoload/namespaced.rb +1 -1
- data/lib/class2/version.rb +1 -1
- data/lib/class2.rb +4 -3
- metadata +7 -9
- data/.travis.yml +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bfd5b014d465ba372f6886d798d8a2e68eb233d4906b326302d77dceb331671
|
4
|
+
data.tar.gz: cd6aa6212aab92a1c32f64ef9e17de551cdb4e6ce68293efca155cc649520068
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90dff1bc730f190875bfe3b72c1d8abde282a5a394d3c95ff8760bb79008b32e39c79baca7a3e67b8ae187a9de5bfa87adedc23837850f44cc9b58c049852568
|
7
|
+
data.tar.gz: 27326bddbefad990d43801f49b23885a97fbeda319329959933eaaca8a35d8e6692b5daa03d564795c60d54633703e1f4297b147edb77f68d13b98c9ebc38cf4
|
data/Changes
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
2024-10-15 v0.6.0
|
2
|
+
--------------------
|
3
|
+
* Bug fix: autoloading in data section with namespace
|
4
|
+
* Add support for Time conversion
|
5
|
+
* Remove use of deprecated Fixnum
|
6
|
+
|
1
7
|
2020-04-24 v0.5.2
|
2
8
|
--------------------
|
3
9
|
* Bug fix: Fix NoMethodError in ActiveSupport 6's Module.parent
|
data/README.md
CHANGED
data/lib/class2/version.rb
CHANGED
data/lib/class2.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "date"
|
4
|
+
require "time" # for parse()
|
4
5
|
require "json"
|
5
6
|
require "active_support/core_ext/module"
|
6
7
|
require "active_support/inflector"
|
@@ -32,13 +33,13 @@ class Class2
|
|
32
33
|
Hash => lambda { |v| sprintf "%s.respond_to?(:to_h) ? %s.to_h : %s", v, v, v },
|
33
34
|
Integer => lambda { |v| "#{v} && Integer(#{v})" },
|
34
35
|
String => lambda { |v| "#{v} && String(#{v})" },
|
36
|
+
Time => lambda { |v| "#{v} && Time.parse(#{v})" },
|
35
37
|
TrueClass => lambda do |v|
|
36
38
|
sprintf '["1", 1, 1.0, true].freeze.include?(%s.is_a?(String) ? %s.strip : %s)', v, v, v
|
37
39
|
end
|
38
40
|
}
|
39
41
|
|
40
42
|
CONVERSIONS[FalseClass] = CONVERSIONS[TrueClass]
|
41
|
-
CONVERSIONS[Fixnum] = CONVERSIONS[Integer]
|
42
43
|
CONVERSIONS.default = lambda { |v| v }
|
43
44
|
|
44
45
|
class << self
|
@@ -58,9 +59,9 @@ class Class2
|
|
58
59
|
nil
|
59
60
|
end
|
60
61
|
|
61
|
-
def autoload(namespace = Object) # :nodoc:
|
62
|
+
def autoload(namespace = Object, stack = nil) # :nodoc:
|
62
63
|
failure = lambda { |message| abort "class2: cannot autoload class definitions: #{message}" }
|
63
|
-
failure["cannot find the right caller"] unless caller.find do |line|
|
64
|
+
failure["cannot find the right caller"] unless (stack || caller).find do |line|
|
64
65
|
# Ignore our autoload file and require()
|
65
66
|
line.index("/class2/autoload.rb:").nil? && line.index("/kernel_require.rb:").nil? && line =~ /(.+):\d+:in\s+`\S/
|
66
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: class2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skye Shaw
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -86,7 +86,7 @@ dependencies:
|
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
|
-
description:
|
89
|
+
description:
|
90
90
|
email:
|
91
91
|
- skye.shaw@gmail.com
|
92
92
|
executables: []
|
@@ -94,7 +94,6 @@ extensions: []
|
|
94
94
|
extra_rdoc_files: []
|
95
95
|
files:
|
96
96
|
- ".gitignore"
|
97
|
-
- ".travis.yml"
|
98
97
|
- Appraisals
|
99
98
|
- Changes
|
100
99
|
- Gemfile
|
@@ -113,7 +112,7 @@ homepage: https://github.com/sshaw/class2
|
|
113
112
|
licenses:
|
114
113
|
- MIT
|
115
114
|
metadata: {}
|
116
|
-
post_install_message:
|
115
|
+
post_install_message:
|
117
116
|
rdoc_options: []
|
118
117
|
require_paths:
|
119
118
|
- lib
|
@@ -128,9 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
127
|
- !ruby/object:Gem::Version
|
129
128
|
version: '0'
|
130
129
|
requirements: []
|
131
|
-
|
132
|
-
|
133
|
-
signing_key:
|
130
|
+
rubygems_version: 3.3.27
|
131
|
+
signing_key:
|
134
132
|
specification_version: 4
|
135
133
|
summary: Easily create hierarchies of classes that support nested attributes, type
|
136
134
|
conversion, equality, and more.
|
data/.travis.yml
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
rvm:
|
5
|
-
- jruby-9
|
6
|
-
- 2.3
|
7
|
-
- 2.4
|
8
|
-
- 2.5
|
9
|
-
- 2.6
|
10
|
-
- 2.7
|
11
|
-
|
12
|
-
before_install:
|
13
|
-
- gem install bundler
|
14
|
-
|
15
|
-
gemfile:
|
16
|
-
- gemfiles/as4.gemfile
|
17
|
-
- gemfiles/as5.gemfile
|
18
|
-
- gemfiles/as6.gemfile
|
19
|
-
|
20
|
-
matrix:
|
21
|
-
exclude:
|
22
|
-
- rvm: 2.3
|
23
|
-
gemfile: gemfiles/as6.gemfile
|
24
|
-
- rvm: 2.4
|
25
|
-
gemfile: gemfiles/as6.gemfile
|
26
|
-
- rvm: 2.7
|
27
|
-
gemfile: gemfiles/as4.gemfile
|
28
|
-
|
29
|
-
notifications:
|
30
|
-
email: false
|