Class: Planter::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/planter/config.rb

Overview

Configure the application seeder.

Examples:

Planter.configure { |seeder| seeder.seeders = %i[users] }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Create a new instance of the config.



56
57
58
59
60
# File 'lib/planter/config.rb', line 56

def initialize
  @quiet = false
  @seeders_directory = ::File.join('db', 'seeds')
  @csv_files_directory = ::File.join('db', 'seed_files')
end

Instance Attribute Details

#csv_files_directoryString

Tell the application where the CSV seed files are kept. Must be a path relative to Rails.root.

Parameters:

  • directory (String)

Returns:

  • (String)


26
27
28
# File 'lib/planter/config.rb', line 26

def csv_files_directory
  @csv_files_directory
end

#erb_trim_modeString

The default trim mode for ERB. Must be “%”, “<>”, “>”, or “-”. For more information, see documentation for ERB::new.

Parameters:

  • erb_trim_mode (String)

Returns:

  • (String)


52
53
54
# File 'lib/planter/config.rb', line 52

def erb_trim_mode
  @erb_trim_mode
end

#quietBoolean

When true, don’t print output when seeding.

Parameters:

  • quiet (Boolean)

Returns:

  • (Boolean)


43
44
45
# File 'lib/planter/config.rb', line 43

def quiet
  @quiet
end

#seedersArray

Tell the application what seeders exist. Elements should be in the correct order to seed the tables successfully, and can be strings or symbols.

Parameters:

  • seeders (Array)

Returns:

  • (Array)


35
36
37
# File 'lib/planter/config.rb', line 35

def seeders
  @seeders
end

#seeders_directoryString

Tell the application where the seeder classes are kept. Must be a path relative to Rails.root.

Parameters:

  • directory (String)

Returns:

  • (String)


17
18
19
# File 'lib/planter/config.rb', line 17

def seeders_directory
  @seeders_directory
end