Sha256: ef7d8080f7e10c8ebff15d1fce8428035a75da9b0adfcf8ebb737d9acefbe12a

Contents?: true

Size: 433 Bytes

Versions: 7

Compression:

Stored size: 433 Bytes

Contents

# 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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ridgepole-0.9.5 spec/erb_helper.rb
ridgepole-0.9.4 spec/erb_helper.rb
ridgepole-0.9.3 spec/erb_helper.rb
ridgepole-0.9.2 spec/erb_helper.rb
ridgepole-0.9.1 spec/erb_helper.rb
ridgepole-0.9.0 spec/erb_helper.rb
ridgepole-0.9.0.rc1 spec/erb_helper.rb