Class: ContributorsStats::Formatter::Html
- Inherits:
-
Object
- Object
- ContributorsStats::Formatter::Html
- Defined in:
- lib/plugins/contributors_stats/formatter/html.rb
Overview
generate html for a contributor, by default it will create a link to profile with contributor avatar
Constant Summary collapse
- DEFAULT_TEMPLATE =
default template building link to profile with contributor avatar
%q{%Q{<a href="#{data['html_url']}" title="#{login} - #{data['contributions']}"><img src="#{data['avatar_url']}" alt="#{login} - #{data['contributions']}"/></a>}}
Instance Attribute Summary collapse
-
#template ⇒ Object
access to the template used to generate content.
Instance Method Summary collapse
-
#format(login, data) ⇒ String
format user data using template.
-
#initialize(options = {}) ⇒ Html
constructor
create the generator object.
Constructor Details
#initialize(options = {}) ⇒ Html
create the generator object
13 14 15 |
# File 'lib/plugins/contributors_stats/formatter/html.rb', line 13 def initialize( = {}) @template = [:template] || DEFAULT_TEMPLATE end |
Instance Attribute Details
#template ⇒ Object
access to the template used to generate content
9 10 11 |
# File 'lib/plugins/contributors_stats/formatter/html.rb', line 9 def template @template end |
Instance Method Details
#format(login, data) ⇒ String
format user data using template
21 22 23 |
# File 'lib/plugins/contributors_stats/formatter/html.rb', line 21 def format(login, data) eval(template) end |