Class: Trokko::Scaffolders::Config::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/trokko/scaffolders/config/database.rb

Overview

Generating config/database.yml file according to configurations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db:, thor:) ⇒ Database

Returns a new instance of Database.



10
11
12
13
# File 'lib/trokko/scaffolders/config/database.rb', line 10

def initialize(db:, thor:)
  @db = db
  @thor = thor
end

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



8
9
10
# File 'lib/trokko/scaffolders/config/database.rb', line 8

def db
  @db
end

#thorObject (readonly)

Returns the value of attribute thor.



8
9
10
# File 'lib/trokko/scaffolders/config/database.rb', line 8

def thor
  @thor
end

Instance Method Details

#generateObject



15
16
17
18
19
20
21
22
# File 'lib/trokko/scaffolders/config/database.rb', line 15

def generate
  thor.template(
    'templates/config/database.yml.erb',
    "#{thor.name}/config/database.yml",
    force: true,
    context: binding
  )
end