-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add readonly flag to fetch_reified_items method #57
Add readonly flag to fetch_reified_items method #57
Conversation
test/models/snapshot_test.rb
Outdated
@@ -107,7 +107,23 @@ def test_fetch_reified_items | |||
|
|||
assert children_hash.is_a?(Hash) | |||
|
|||
assert children_hash.all?{|k,v| v.all?{|x| x.readonly?} } | |||
assert children_hash.all? { |_k, v| v.all? { |x| x.readonly? } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert children_hash.all? { |_k, v| v.all? { |x| x.readonly? } } | |
assert children_hash.values.all?(&:readonly?) |
test/models/snapshot_test.rb
Outdated
|
||
assert children_hash.is_a?(Hash) | ||
|
||
assert children_hash.all? { |_k, v| v.all? { |x| x.readonly? } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert children_hash.all? { |_k, v| v.all? { |x| x.readonly? } } | |
assert children_hash.values.all?(&:readonly?) |
reified_children_hash = {}.with_indifferent_access | ||
|
||
reified_parent = nil | ||
|
||
snapshot_items.each do |si| | ||
reified_item = si.item_type.constantize.new(si.object) | ||
|
||
reified_item.readonly! | ||
reified_item.readonly! if readonly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use multiline if statement here. Thanks
if readonly
reified_item.readonly!
end
Looks like a good change. I've suggested a couple of comments Also can we maybe update the section in the README
to:
|
README.md
Outdated
reified_parent, reified_children_hash = snapshot.fetch_reified_items(readonly: false) | ||
``` | ||
|
||
# OR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge the two codeblocks and move this inside the code block
Merged thanks for your contribution! |
No description provided.