Skip to content

Commit ab6bc64

Browse files
authored
fix: Upgrade for compatibility with Ruby 3 (#45)
1 parent bb28116 commit ab6bc64

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.github/workflows/tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
ruby-version: ['2.6', '2.7']
15+
ruby-version: ['2.7', '3.0', '3.1']
1616

1717
steps:
1818
- uses: actions/checkout@v2

lib/openactive/concerns/json_ld_serializable.rb

+6-4
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@ def property(field, as:)
2525

2626
def values
2727
data = {}
28-
self.class.properties.each do |key, field:|
29-
data[key] = send(field)
28+
self.class.properties.each do |key, field|
29+
field_value = field[:field]
30+
data[key] = send(field_value)
3031
end
3132
data
3233
end
3334

3435
def to_h
3536
data = {}
36-
self.class.properties.each do |_key, field:|
37-
data[field] = send(field)
37+
self.class.properties.each do |_key, field|
38+
field_value = field[:field]
39+
data[field_value] = send(field_value)
3840
end
3941
data
4042
end

0 commit comments

Comments
 (0)