Sha256: 097b1fae053bdcdc504959815a10cb2ac6ad4b99b06aba94549cadebf93d552e

Contents?: true

Size: 895 Bytes

Versions: 13

Compression:

Stored size: 895 Bytes

Contents

include ERBh

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

ERBh.define_method(:add_index) do |table_name, column_name, options|
  if condition(:activerecord_5)
    @_erbout.sub!(/\bend\s*\z/, '')

    <<-EOS
        t.index #{column_name.inspect}, #{options.modern_inspect_without_brace}
      end
    EOS
  else
    "add_index #{table_name.inspect}, #{column_name.inspect}, #{options.modern_inspect_without_brace}"
  end
end

ERBh.define_method(:unsigned) do |value, *conds|
  conds = [:mysql_awesome_enabled] if conds.empty?

  if condition(*conds)
    {unsigned: value}
  else
    {}
  end
end

ERBh.define_method(:limit) do |value, *conds|
  conds = [:activerecord_4] if conds.empty?

  if condition(*conds)
    {limit: value}
  else
    {}
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ridgepole-0.6.5.beta14 spec/erb_helper.rb
ridgepole-0.6.5.beta13 spec/erb_helper.rb
ridgepole-0.6.5.beta12 spec/erb_helper.rb
ridgepole-0.6.5.beta11 spec/erb_helper.rb
ridgepole-0.6.5.beta10 spec/erb_helper.rb
ridgepole-0.6.5.beta9 spec/erb_helper.rb
ridgepole-0.6.5.beta8 spec/erb_helper.rb
ridgepole-0.6.5.beta7 spec/erb_helper.rb
ridgepole-0.6.5.beta6 spec/erb_helper.rb
ridgepole-0.6.5.beta5 spec/erb_helper.rb
ridgepole-0.6.5.beta4 spec/erb_helper.rb
ridgepole-0.6.5.beta3 spec/erb_helper.rb
ridgepole-0.6.5.beta2 spec/erb_helper.rb