Class: Producer::Core::Actions::FileReplaceContent
Constant Summary
Producer::Core::Action::INSPECT_ARGUMENTS_SUM_LEN
Instance Attribute Summary
#arguments, #env, #options
Instance Method Summary
collapse
#initialize, #to_s
Instance Method Details
#apply ⇒ Object
14
15
16
|
# File 'lib/producer/core/actions/file_replace_content.rb', line 14
def apply
fs.file_write @path, replaced_content
end
|
#name ⇒ Object
10
11
12
|
# File 'lib/producer/core/actions/file_replace_content.rb', line 10
def name
'file_replace_content'
end
|
#replaced_content ⇒ Object
18
19
20
|
# File 'lib/producer/core/actions/file_replace_content.rb', line 18
def replaced_content
fs.file_read(@path).gsub @pattern, @replacement
end
|
#setup ⇒ Object
5
6
7
8
|
# File 'lib/producer/core/actions/file_replace_content.rb', line 5
def setup
check_arguments_size! 3
@path, @pattern, @replacement = arguments
end
|