Class: Hubba::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/hubba/reports/reports/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(stats_or_hash_or_path = Hubba.stats) ⇒ Report

Returns a new instance of Report.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/hubba/reports/reports/base.rb', line 4

def initialize( stats_or_hash_or_path=Hubba.stats )
  ## puts "[debug] Report#initialize:"
  ## pp  stats_or_hash_or_path   if stats_or_hash_or_path.is_a?( String )

  @stats = if stats_or_hash_or_path.is_a?( String ) ||
              stats_or_hash_or_path.is_a?( Hash )
                hash_or_path = stats_or_hash_or_path
                Hubba.stats( hash_or_path )
           else
                stats_or_hash_or_path  ## assume Summary/Stats - todo/fix: double check!!!
           end
end

Instance Method Details

#save(path) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hubba/reports/reports/base.rb', line 18

def save( path )
  buf = build

  banner =<<TXT
Auto-generated github (statistics) report;
built with [Hubba v#{HubbaReports::VERSION}](https://github.com/rubycoco/git/tree/master/hubba-reports).


TXT

  puts "writing report >#{path}< ..."
  File.open( path, "w:utf-8" ) do |f|
    f.write( banner )   ## add banner for now - why? why not?
    f.write( buf )
  end
end