Class: RailsCopier::Folder

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_copier/folder.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to, new_name) ⇒ Folder

Returns a new instance of Folder.



9
10
11
12
13
# File 'lib/rails_copier/folder.rb', line 9

def initialize(from, to, new_name)
  @new_name = new_name
  @from     = from
  @to       = to
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



3
4
5
# File 'lib/rails_copier/folder.rb', line 3

def from
  @from
end

#new_dirObject

Returns the value of attribute new_dir.



3
4
5
# File 'lib/rails_copier/folder.rb', line 3

def new_dir
  @new_dir
end

#new_nameObject

Returns the value of attribute new_name.



3
4
5
# File 'lib/rails_copier/folder.rb', line 3

def new_name
  @new_name
end

#toObject

Returns the value of attribute to.



3
4
5
# File 'lib/rails_copier/folder.rb', line 3

def to
  @to
end

Class Method Details

.create(from, to, new_name) ⇒ Object



5
6
7
# File 'lib/rails_copier/folder.rb', line 5

def self.create(from, to, new_name)
  new(from, to, new_name).save
end

Instance Method Details

#path_to_secretsObject



20
21
22
# File 'lib/rails_copier/folder.rb', line 20

def path_to_secrets
  "#{new_dir}/config/secrets.yml"
end

#saveObject



15
16
17
18
# File 'lib/rails_copier/folder.rb', line 15

def save
  @new_dir = FileUtils::mkdir_p("#{to}/#{new_name.underscore}").join
  self
end