module TmuxERBParser::Helpers::FormatHelper

Public Instance Methods

format_and(*args) click to toggle source
# File lib/tmux-erb-parser/helpers/format_helper.rb, line 6
def format_and(*args)
  return args.first if args.length < 2

  args.inject { |result, val| format_cond('&&', result, val) }
end
format_cond(operator, arg1, arg2) click to toggle source
# File lib/tmux-erb-parser/helpers/format_helper.rb, line 18
def format_cond(operator, arg1, arg2)
  "\#{#{operator}:#{arg1},#{arg2}}"
end
format_if(cond, true_value, false_value = nil) click to toggle source
# File lib/tmux-erb-parser/helpers/format_helper.rb, line 22
def format_if(cond, true_value, false_value = nil)
  "\#{?#{cond},#{true_value},#{false_value}}"
end
format_or(*args) click to toggle source
# File lib/tmux-erb-parser/helpers/format_helper.rb, line 12
def format_or(*args)
  return args.first if args.length < 2

  args.inject { |result, val| format_cond('||', result, val) }
end