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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, content:) ⇒ ReplaceFileContent

Returns a new instance of ReplaceFileContent.



19
20
21
22
# File 'lib/convenient_service/examples/standard/v1/gemfile/services/replace_file_content.rb', line 19

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

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



12
13
14
# File 'lib/convenient_service/examples/standard/v1/gemfile/services/replace_file_content.rb', line 12

def content
  @content
end

#pathObject (readonly)

Returns the value of attribute path.



12
13
14
# File 'lib/convenient_service/examples/standard/v1/gemfile/services/replace_file_content.rb', line 12

def path
  @path
end

Instance Method Details

#resultObject



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

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

  success
end