Skip to content
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

Fixed the scope issue for the private method #167

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/bolognese/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ def descriptions
@descriptions ||= meta.fetch("descriptions", nil)
end

def abstract_description
# Fetch the first description with descriptionType "Abstract"
@abstract_description ||= descriptions&.find { |d| d["descriptionType"] == "Abstract" }
end

def rights_list
@rights_list ||= meta.fetch("rights_list", nil)
end
Expand Down
7 changes: 7 additions & 0 deletions lib/bolognese/writers/ris_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ def ris
"ER" => ""
}.compact.map { |k, v| v.is_a?(Array) ? v.map { |vi| "#{k} - #{vi}" }.join("\r\n") : "#{k} - #{v}" }.join("\r\n")
end

private

def abstract_description
# Fetch the first description with descriptionType "Abstract"
descriptions&.find { |d| d["descriptionType"] == "Abstract" }
end
end
end
end
7 changes: 7 additions & 0 deletions lib/bolognese/writers/schema_org_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ def schema_hsh
def schema_org
JSON.pretty_generate schema_hsh
end

private

def abstract_description
# Fetch the first description with descriptionType "Abstract"
descriptions&.find { |d| d["descriptionType"] == "Abstract" }
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm just wondering if we could perhaps DRY this implementation since we do repeat this method. I'm not sure about the code structure but maybe it could go into a writers concern or in some utility module? if this is not possible please do not hesitate to let me know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are absolutely correct Wendel, I am just thinking what would be best place to add these to helper file. Thank you for the review

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wendelfabianchinsamy moved the method to the common place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant! Nice one @ashwinisukale 🚀.

end
end
end