class Guard::I18nJson
Constants
- VERSION
Attributes
config_file[R]
current_thread[R]
require_file[R]
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
# File lib/guard/i18n_json.rb, line 14 def initialize(options = {}) @config_file = options.delete(:config_file) @require_file = options.delete(:require_file) super end
Public Instance Methods
error(message)
click to toggle source
# File lib/guard/i18n_json.rb, line 69 def error(message) ::Guard::UI.error "[guard-i18n-json] #{message}" end
export_files()
click to toggle source
# File lib/guard/i18n_json.rb, line 48 def export_files return unless validate_file(:config_file, config_file) return unless validate_file(:require_file, require_file) current_thread&.exit @current_thread = Thread.new do require @require_file ::I18nJSON.call(config_file: @config_file) end current_thread.join end
reload()
click to toggle source
# File lib/guard/i18n_json.rb, line 28 def reload export_files end
run_all()
click to toggle source
# File lib/guard/i18n_json.rb, line 32 def run_all export_files end
run_on_additions(_paths)
click to toggle source
# File lib/guard/i18n_json.rb, line 36 def run_on_additions(_paths) export_files end
run_on_modifications(_paths)
click to toggle source
# File lib/guard/i18n_json.rb, line 40 def run_on_modifications(_paths) export_files end
run_on_removals(_paths)
click to toggle source
# File lib/guard/i18n_json.rb, line 44 def run_on_removals(_paths) export_files end
start()
click to toggle source
# File lib/guard/i18n_json.rb, line 20 def start export_files end
stop()
click to toggle source
# File lib/guard/i18n_json.rb, line 24 def stop current_thread&.exit end
validate_file(key, file)
click to toggle source
# File lib/guard/i18n_json.rb, line 62 def validate_file(key, file) return true if file && File.file?(file) error("#{key.inspect} must be a file") false end