actionset 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -0
- data/Gemfile +1 -0
- data/lib/action_set.rb +1 -0
- data/lib/action_set/instructions/entry_value.rb +18 -8
- data/lib/action_set/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ee586ba731ff0d62c70c6417a6a66e439118ed2
|
4
|
+
data.tar.gz: f9db7e51b54c2865171d2b4bf34751565e602616
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca9fc3e8a5446736ecce76e39b5d16bda747f231760fbc25ed644ca55a5c60895844a50cddbca18befe9cbd0c4a190bcb7b7cc93d5d01adaf3767e0b4d9bf530
|
7
|
+
data.tar.gz: 545317adeca664239fdbcfb9413d4dcd9a3c7d4b1a08dd0b1ae50a982d75be32a29ebda542ea01f208343ff440797e3caf4c2fbf6e652e3986842cb08df48d35
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
v 0.1.3
|
2
|
+
- Ensure that the ActiveModelAdapter for the typcastor properly downgrades from using ActiveModel::Type to using ActiveRecord::Type
|
3
|
+
- Ensure that OpenStuct is explicly required
|
4
|
+
- Ensure that the internal dummy app has the actionpack infrastructure properly in place for view specs
|
5
|
+
- Fix the filter view specs
|
1
6
|
v 0.1.2
|
2
7
|
- Properly specify the version dependency on ActiveSupport
|
3
8
|
v 0.1.1
|
data/Gemfile
CHANGED
data/lib/action_set.rb
CHANGED
@@ -55,7 +55,11 @@ module ActionSet
|
|
55
55
|
end
|
56
56
|
|
57
57
|
class ActiveModelAdapter
|
58
|
-
|
58
|
+
begin
|
59
|
+
require 'active_model/type'
|
60
|
+
rescue LoadError
|
61
|
+
require 'active_record/type'
|
62
|
+
end
|
59
63
|
|
60
64
|
def initialize(raw, target)
|
61
65
|
@raw = raw
|
@@ -74,11 +78,11 @@ module ActionSet
|
|
74
78
|
end
|
75
79
|
|
76
80
|
def possible_typecasters
|
77
|
-
@possible_typecasters ||=
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
81
|
+
@possible_typecasters ||= type_class.constants
|
82
|
+
.map(&:to_s)
|
83
|
+
.select { |t| can_typecast?(t) }
|
84
|
+
.map { |t| init_typecaster(t) }
|
85
|
+
.compact
|
82
86
|
end
|
83
87
|
|
84
88
|
def typecast(to_type, value)
|
@@ -87,16 +91,22 @@ module ActionSet
|
|
87
91
|
end
|
88
92
|
|
89
93
|
def can_typecast?(const_name)
|
90
|
-
typecasting_class =
|
94
|
+
typecasting_class = type_class.const_get(const_name)
|
91
95
|
typecasting_class.instance_methods.include?(:cast) ||
|
92
96
|
typecasting_class.instance_methods.include?(:type_cast)
|
93
97
|
end
|
94
98
|
|
95
99
|
def init_typecaster(const_name)
|
96
|
-
|
100
|
+
type_class.const_get(const_name).new
|
97
101
|
rescue
|
98
102
|
nil
|
99
103
|
end
|
104
|
+
|
105
|
+
def type_class
|
106
|
+
ActiveModel::Type
|
107
|
+
rescue NameError
|
108
|
+
ActiveRecord::Type
|
109
|
+
end
|
100
110
|
end
|
101
111
|
|
102
112
|
class BooleanAdapter
|
data/lib/action_set/version.rb
CHANGED