Class: GithubDailyDigest::HtmlFormatter
- Inherits:
-
Object
- Object
- GithubDailyDigest::HtmlFormatter
- Defined in:
- lib/html_formatter.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(data, options = {}) ⇒ HtmlFormatter
constructor
A new instance of HtmlFormatter.
Constructor Details
#initialize(data, options = {}) ⇒ HtmlFormatter
Returns a new instance of HtmlFormatter.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/html_formatter.rb', line 8 def initialize(data, = {}) @data = normalize_data(data) @output_file = [:output_file] || generate_default_filename @theme = [:theme] || 'default' # Can be 'default', 'dark', or 'light' @chart_theme = [:chart_theme] || 'default' # Can customize chart colors @title = [:title] || "GitHub Daily Digest - #{Time.now.strftime('%Y-%m-%d')}" @show_charts = .key?(:show_charts) ? [:show_charts] : true @show_extended = .key?(:show_extended) ? [:show_extended] : true @show_repo_details = .key?(:show_repo_details) ? [:show_repo_details] : true @show_language_details = .key?(:show_language_details) ? [:show_language_details] : true @show_work_details = .key?(:show_work_details) ? [:show_work_details] : true @raw_data = [:raw_data] # Store raw data for later use end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/html_formatter.rb', line 6 def data @data end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
6 7 8 |
# File 'lib/html_formatter.rb', line 6 def output_file @output_file end |
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
6 7 8 |
# File 'lib/html_formatter.rb', line 6 def theme @theme end |
Instance Method Details
#generate ⇒ Object
22 23 24 25 26 27 |
# File 'lib/html_formatter.rb', line 22 def generate html_content = build_html File.write(output_file, html_content) puts "HTML report generated at: #{output_file}" output_file end |