Class: Swoop::TimeMachine
- Inherits:
-
Object
- Object
- Swoop::TimeMachine
- Defined in:
- lib/swoop/time_machine.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
-
#initialize(project, options) ⇒ TimeMachine
constructor
A new instance of TimeMachine.
- #project_path ⇒ Object
- #travel {|project, current_branch, Time.now| ... } ⇒ Object
Constructor Details
#initialize(project, options) ⇒ TimeMachine
Returns a new instance of TimeMachine.
9 10 11 12 13 14 |
# File 'lib/swoop/time_machine.rb', line 9 def initialize(project, ) @project = project = [:tags] || 8 @weeks = [:weeks] || 0 @filter = [:filter] end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
7 8 9 |
# File 'lib/swoop/time_machine.rb', line 7 def project @project end |
Instance Method Details
#project_path ⇒ Object
16 17 18 |
# File 'lib/swoop/time_machine.rb', line 16 def project_path @project_path ||= @project.path end |
#travel {|project, current_branch, Time.now| ... } ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/swoop/time_machine.rb', line 20 def travel current_branch = git.current_branch logs.each do |t| log = t.log.first git.checkout(log.sha) yield(project, t.name, log.date) end git.branches[current_branch].checkout yield(project, current_branch, Time.now) end |