Class: Anchor::TypeScript::MultifileSaveService
- Inherits:
-
Object
- Object
- Anchor::TypeScript::MultifileSaveService
- Defined in:
- lib/anchor/type_script/multifile_save_service.rb
Constant Summary collapse
- START_MARKER =
"// START AUTOGEN\n"- END_MARKER =
"\n// END AUTOGEN\n"- REGEX =
/#{Regexp.escape(START_MARKER)}(.*?)#{Regexp.escape(END_MARKER)}/m
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(generator:, folder_path:, force: false, trust_hash: true) ⇒ MultifileSaveService
constructor
A new instance of MultifileSaveService.
Constructor Details
#initialize(generator:, folder_path:, force: false, trust_hash: true) ⇒ MultifileSaveService
Returns a new instance of MultifileSaveService.
11 12 13 14 15 16 |
# File 'lib/anchor/type_script/multifile_save_service.rb', line 11 def initialize(generator:, folder_path:, force: false, trust_hash: true) @generator = generator @folder_path = folder_path @force = force @trust_hash = trust_hash end |
Class Method Details
.call ⇒ Object
7 8 9 |
# File 'lib/anchor/type_script/multifile_save_service.rb', line 7 def self.call(...) new(...).call end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/anchor/type_script/multifile_save_service.rb', line 18 def call FileUtils.mkdir_p(@folder_path) results = @generator.call modified_files = results.filter_map { |result| save_result(result) } save_sha modified_files end |