Class: GithubStats::CLI::CommaSeperatedLinePerResultResultsView
- Inherits:
-
Object
- Object
- GithubStats::CLI::CommaSeperatedLinePerResultResultsView
- Defined in:
- lib/github_stats/cli.rb
Overview
Transforms a result set into a space-seperated table the results hash keys becoming the table headers and line breaks between rows.
Instance Attribute Summary collapse
-
#results ⇒ Object
Returns the value of attribute results.
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(results) ⇒ CommaSeperatedLinePerResultResultsView
constructor
A new instance of CommaSeperatedLinePerResultResultsView.
- #to_s ⇒ Object
Constructor Details
#initialize(results) ⇒ CommaSeperatedLinePerResultResultsView
Returns a new instance of CommaSeperatedLinePerResultResultsView.
52 53 54 |
# File 'lib/github_stats/cli.rb', line 52 def initialize(results) self.results = results end |
Instance Attribute Details
#results ⇒ Object
Returns the value of attribute results.
51 52 53 |
# File 'lib/github_stats/cli.rb', line 51 def results @results end |
Instance Method Details
#fields ⇒ Object
56 57 58 |
# File 'lib/github_stats/cli.rb', line 56 def fields results.keys end |
#to_s ⇒ Object
60 61 62 63 64 |
# File 'lib/github_stats/cli.rb', line 60 def to_s fields.join(',') + "\n" + results.map do |result| fields.map(&result.method(:fetch)).join(',') end.join("\n") end |