Class: Augit::Presenter
- Inherits:
-
Object
- Object
- Augit::Presenter
- Includes:
- ActionView::Helpers::DateHelper, ActionView::Helpers::TextHelper
- Defined in:
- lib/augit/presenter.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
Instance Method Summary collapse
- #branch ⇒ Object
- #files ⇒ Object
-
#initialize(name, origin) ⇒ Presenter
constructor
A new instance of Presenter.
- #oneline(name, origin) ⇒ Object
- #print ⇒ Object
Constructor Details
#initialize(name, origin) ⇒ Presenter
Returns a new instance of Presenter.
10 11 12 13 |
# File 'lib/augit/presenter.rb', line 10 def initialize(name, origin) @name = name @origin = origin end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/augit/presenter.rb', line 8 def name @name end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
8 9 10 |
# File 'lib/augit/presenter.rb', line 8 def origin @origin end |
Instance Method Details
#branch ⇒ Object
37 38 39 |
# File 'lib/augit/presenter.rb', line 37 def branch @branch ||= Branch.new(name, origin) end |
#files ⇒ Object
41 42 43 |
# File 'lib/augit/presenter.rb', line 41 def files branch.files end |
#oneline(name, origin) ⇒ Object
32 33 34 35 |
# File 'lib/augit/presenter.rb', line 32 def oneline(name, origin) info = branch_info(name, origin) puts " #{info[:name].send(presenter.age_color(info[:age]))}" end |
#print ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/augit/presenter.rb', line 15 def print name = "#{branch.name}".send(age_color(branch.age)) commits = pluralize(branch.commit_count, 'commit') age = distance_of_time_in_words_to_now(branch.age) filelist = files.first(5).compact.join("\n ").light_black ellipsis = "\n...\nand #{files.length - 5} more...".light_black puts <<-eos #{name} #{branch.} #{commits} - #{age} ago #{filelist}#{ellipsis if files.length > 5} #{branch.compare_url} eos end |