Module: GuardHelpers::SrtHelper

Includes:
BaseHelper
Defined in:
lib/guard_helpers/srt_helper.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#run_on_modifications(paths) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/guard_helpers/srt_helper.rb', line 28

def run_on_modifications(paths)
  super if defined? super

  handle_each_path(%r{^subtitle_template/(.+)\.erb$}) do
    build_all_subtt
  end
end

#startObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/guard_helpers/srt_helper.rb', line 11

def start
  super if defined? super
  create_open_file("subtitle_template", "erb")

  cmds = ::Pry::CommandSet.new do
    block_command "bs", "build subtitle template in subtitle_template" do |*args|
      build_all_subtt
    end

    block_command "clearall", "clear all records" do |*args|
      Sub.delete_all
      Ln.delete_all
    end
  end
  ::Pry::Commands.import cmds
end