initializer(filename, data=nil, &block) public

Create a new initializer with the provided code (either in a block or a string).

Examples

  initializer("globals.rb") do
    data = ""

    ['MY_WORK', 'ADMINS', 'BEST_COMPANY_EVAR'].each do
      data << "#{const} = :entp"
    end

    data
  end

  initializer("api.rb", "API_KEY = '123456'")
Show source
Register or log in to add new notes.