Class: Commenter::GitHubIssueRetriever
- Inherits:
-
Object
- Object
- Commenter::GitHubIssueRetriever
- Defined in:
- lib/commenter/github_integration.rb
Instance Method Summary collapse
-
#initialize(config_path) ⇒ GitHubIssueRetriever
constructor
A new instance of GitHubIssueRetriever.
- #retrieve_observations_from_yaml(yaml_file, options = {}) ⇒ Object
Constructor Details
#initialize(config_path) ⇒ GitHubIssueRetriever
Returns a new instance of GitHubIssueRetriever.
283 284 285 286 287 288 289 |
# File 'lib/commenter/github_integration.rb', line 283 def initialize(config_path) @config = load_config(config_path) @github_client = create_github_client @repo = @config.dig("github", "repository") raise "GitHub repository not specified in config" unless @repo end |
Instance Method Details
#retrieve_observations_from_yaml(yaml_file, options = {}) ⇒ Object
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/commenter/github_integration.rb', line 291 def retrieve_observations_from_yaml(yaml_file, = {}) data = YAML.load_file(yaml_file) comment_sheet = CommentSheet.from_hash(data) results = [] comment_sheet.comments.each do |comment| next unless comment.has_github_issue? result = if [:dry_run] preview_observation_retrieval(comment, ) else retrieve_observation(comment, ) end results << result end # Update YAML with observations (unless dry run) update_yaml_with_observations(yaml_file, comment_sheet, ) unless [:dry_run] results end |