# frozen_string_literal: true

include ERBh

ERBh.define_method(:i) do |obj|
  if obj.nil? || (obj.respond_to?(:empty?) && obj.empty?)
    @_erbout.sub!(/,\s*\z/, '')
    ''
  elsif obj.is_a?(Hash)
    obj.modern_inspect_without_brace
  else
    obj
  end
end

ERBh.define_method(:cond) do |conds, m, e = nil|
  if conds.is_a?(Hash)
    conds.find do |c, _|
      condition(c)
    end&.last || m
  elsif condition(conds)
    m
  else
    e || (begin
      m.class.new
    rescue StandardError
      nil
    end)
  end
end

# frozen_string_literal: true

include ERBh

ERBh.define_method(:i) do |obj|
  if obj.nil? || (obj.respond_to?(:empty?) && obj.empty?)
    @_erbout.sub!(/,\s*\z/, '')
    ''
  elsif obj.is_a?(Hash)
    obj.modern_inspect_without_brace
  else
    obj
  end
end

ERBh.define_method(:cond) do |conds, m, e = nil|
  if condition(conds)
    m
  else
    e || (begin
      m.class.new
    rescue StandardError
      nil
    end)
  end
end

Remove unused branch because it is not called from anywhere
Remove unused branch because it is not called from anywhere
