Skip to content

Commit

Permalink
Merge branch 'master' into ci/update-data-models
Browse files Browse the repository at this point in the history
  • Loading branch information
nickevansuk authored Jun 17, 2024
2 parents 8162a92 + ab6bc64 commit 4e962d1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.6', '2.7']
ruby-version: ['2.7', '3.0', '3.1']

steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 6 additions & 4 deletions lib/openactive/concerns/json_ld_serializable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ def property(field, as:)

def values
data = {}
self.class.properties.each do |key, field:|
data[key] = send(field)
self.class.properties.each do |key, field|
field_value = field[:field]
data[key] = send(field_value)
end
data
end

def to_h
data = {}
self.class.properties.each do |_key, field:|
data[field] = send(field)
self.class.properties.each do |_key, field|
field_value = field[:field]
data[field_value] = send(field_value)
end
data
end
Expand Down
4 changes: 3 additions & 1 deletion spec/data_structure/data_structure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
}
]

objs.each do |model:, data:|
objs.each do |obj|
model = obj[:model]
data = obj[:data]
describe model do
let(:inst) { model.deserialize(data) }

Expand Down
5 changes: 4 additions & 1 deletion spec/data_typing/data_typing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
}
]

objs.each do |model:, data:|
objs.each do |obj|
model = obj[:model]
data = obj[:data]

describe model do
describe "#type" do
it "reserializes to original value" do
Expand Down

0 comments on commit 4e962d1

Please sign in to comment.