Class: ConvenientService::Examples::Standard::Gemfile::Services::ReplaceFileContent

Inherits:
Object
  • Object
show all
Includes:
Service::Configs::Standard
Defined in:
lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Service::Configs::Standard

service?, service_class?

Methods included from Config

included

Constructor Details

#initialize(path:, content:) ⇒ ReplaceFileContent

Returns a new instance of ReplaceFileContent.



23
24
25
26
# File 'lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb', line 23

def initialize(path:, content:)
  @path = path
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



16
17
18
# File 'lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb', line 16

def content
  @content
end

#pathObject (readonly)

Returns the value of attribute path.



16
17
18
# File 'lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb', line 16

def path
  @path
end

Instance Method Details

#resultObject



28
29
30
31
32
# File 'lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb', line 28

def result
  ::File.write(path, content)

  success
end