easol-canvas 4.17.0 → 4.18.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 012fee086d69a166e3b2e062e0e8d9f658db0749bed1dad6e5a30c25ea4c8678
|
4
|
+
data.tar.gz: fb1a4df7f2aa7961c16e85b26472dd35e728b4c5519ef7f7a99c41a14c25e82a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56ced44aa44c09a09f254c459dc35962b9114e5a747c5d257df0cef32d2bdd94739dd46c779344ecd4fb7df58c54a9614179bda162405ae889c9fb70fc33cc1a
|
7
|
+
data.tar.gz: 23128bde9e9f69d7faf52e121f8bc077ec68a9407cad32b7ff15b4863fa8dadb3f0bf92cff5e1a2a1b1b27f88ac833a934d6636825178a80eadde036d5e8d65b
|
data/lib/canvas/constants.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Canvas
|
4
|
+
module Validator
|
5
|
+
class SchemaAttribute
|
6
|
+
# :documented:
|
7
|
+
# Attribute validations specific to modifier-type variables.
|
8
|
+
# Modifier drops expose name and id properties for use in site builder schemas.
|
9
|
+
class Modifier < Base
|
10
|
+
ALLOWED_DEFAULT_VALUES = %w[random].freeze
|
11
|
+
|
12
|
+
def validate
|
13
|
+
super &&
|
14
|
+
ensure_default_values_are_valid
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def permitted_values_for_default_key
|
20
|
+
if attribute["array"]
|
21
|
+
Array
|
22
|
+
else
|
23
|
+
String
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def ensure_default_values_are_valid
|
28
|
+
return true unless attribute.key?("default")
|
29
|
+
|
30
|
+
if attribute["array"]
|
31
|
+
attribute["default"].all? { |value| default_value_is_valid?(value) }
|
32
|
+
else
|
33
|
+
default_value_is_valid?(attribute["default"])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def default_value_is_valid?(value)
|
38
|
+
value = value.downcase
|
39
|
+
if !ALLOWED_DEFAULT_VALUES.include?(value)
|
40
|
+
@errors << %["default" for modifier-type variables must be one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}]
|
41
|
+
false
|
42
|
+
else
|
43
|
+
true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/canvas/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easol-canvas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Byrne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- lib/canvas/validators/schema_attributes/experience_slot.rb
|
146
146
|
- lib/canvas/validators/schema_attributes/image.rb
|
147
147
|
- lib/canvas/validators/schema_attributes/link.rb
|
148
|
+
- lib/canvas/validators/schema_attributes/modifier.rb
|
148
149
|
- lib/canvas/validators/schema_attributes/number.rb
|
149
150
|
- lib/canvas/validators/schema_attributes/package.rb
|
150
151
|
- lib/canvas/validators/schema_attributes/page.rb
|