Skip to content

Commit

Permalink
chore: Refactor JSON-LD serialization logic
Browse files Browse the repository at this point in the history
  • Loading branch information
nickevansuk committed Jun 17, 2024
1 parent bb28116 commit 30fc9b0
Showing 1 changed file with 6 additions and 4 deletions.
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

0 comments on commit 30fc9b0

Please sign in to comment.