class IssueExporting::CsvOutputter
Public Instance Methods
write(response_text)
click to toggle source
# File lib/issue_exporter/outputter.rb, line 30 def write(response_text) path = @options[:path] || default_path array_of_issues = JSON.parse response_text keys = ["number", "title", "state", "user.login", "created_at", "updated_at", "closed_at", "url"] text = "Issue #,Title,State,Created By,Created At,Last Updated At,Closed At,GitHub URL\n" mapped_values = array_of_issues.map do |issue| values = keys.map do |key| args = key.split '.' issue.dig(*args) end values.to_csv end csv_text = text + mapped_values.join("") write_file path, csv_text end
Protected Instance Methods
default_filename()
click to toggle source
# File lib/issue_exporter/outputter.rb, line 47 def default_filename "issues.csv" end