Class: GitPresenter::Slide
- Inherits:
-
Object
- Object
- GitPresenter::Slide
- Defined in:
- lib/git_presenter/slide.rb
Instance Attribute Summary collapse
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#run ⇒ Object
readonly
Returns the value of attribute run.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(slide) ⇒ Slide
constructor
A new instance of Slide.
- #to_s ⇒ Object
Constructor Details
#initialize(slide) ⇒ Slide
Returns a new instance of Slide.
4 5 6 7 8 9 |
# File 'lib/git_presenter/slide.rb', line 4 def initialize() @commit = ["commit"] @message = ["message"] @run = ["run"] @launch = ["launch"] end |
Instance Attribute Details
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
2 3 4 |
# File 'lib/git_presenter/slide.rb', line 2 def commit @commit end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
2 3 4 |
# File 'lib/git_presenter/slide.rb', line 2 def @message end |
#run ⇒ Object (readonly)
Returns the value of attribute run.
2 3 4 |
# File 'lib/git_presenter/slide.rb', line 2 def run @run end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/git_presenter/slide.rb', line 11 def execute output = "" output << checkout unless @commit.nil? output << `#{run}` unless @run.nil? Launchy.open(@launch) unless @launch.nil? output end |
#to_s ⇒ Object
19 20 21 22 |
# File 'lib/git_presenter/slide.rb', line 19 def to_s return "#{@commit[0..9]}, #{@message}" unless @commit.nil? "run: #{@run}" end |