Class: GitPresenter::Controller
- Inherits:
-
Object
- Object
- GitPresenter::Controller
- Defined in:
- lib/git_presenter/controller.rb
Constant Summary collapse
- CONFIG_FILE =
".presentation"
Instance Method Summary collapse
- #initialise_presentation ⇒ Object
-
#initialize(file_path) ⇒ Controller
constructor
A new instance of Controller.
- #start_presentation ⇒ Object
- #update_presentation ⇒ Object
Constructor Details
#initialize(file_path) ⇒ Controller
4 5 6 |
# File 'lib/git_presenter/controller.rb', line 4 def initialize(file_path) @presentation_dir = file_path end |
Instance Method Details
#initialise_presentation ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/git_presenter/controller.rb', line 8 def initialise_presentation yaml = {"slides" => }.to_yaml File.open(presentation_file_location, "w") do |file| file.write(yaml) end puts "Presentation has been initalised" puts "run 'git-presenter start' to begin the presentation" end |
#start_presentation ⇒ Object
17 18 19 20 21 22 |
# File 'lib/git_presenter/controller.rb', line 17 def start_presentation yaml = YAML.parse(File.open(@presentation_dir + "/.presentation", "r")).to_ruby presenter = GitPresenter::Presentation.new(yaml) puts presenter.start presenter end |
#update_presentation ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/git_presenter/controller.rb', line 24 def update_presentation yaml = YAML.parse(File.open(@presentation_dir + "/.presentation", "r")).to_ruby = (yaml['slides'].last["slide"]["commit"]) last_commit = yaml["slides"].last yaml["slides"] = yaml["slides"] + yaml["slides"].uniq! write_file(yaml.to_yaml) puts "Your presentation has been updated" end |