Class: Dryer::Clients::Gems::ContractFiles::Create

Inherits:
Services::SimpleService
  • Object
show all
Defined in:
lib/dryer/clients/gems/contract_files/create.rb

Instance Method Summary collapse

Constructor Details

#initialize(gem_module_name:, input_directory:, output_directory:) ⇒ Create

Returns a new instance of Create.



11
12
13
14
15
16
17
18
19
# File 'lib/dryer/clients/gems/contract_files/create.rb', line 11

def initialize(
  gem_module_name:,
  input_directory:,
  output_directory:
)
  @gem_module_name = gem_module_name
  @input_directory = input_directory
  @output_directory = output_directory
end

Instance Method Details

#callObject



21
22
23
24
25
26
27
28
29
# File 'lib/dryer/clients/gems/contract_files/create.rb', line 21

def call
  input_paths.map do |input|
    contents = File.read(input)
    {
      path: output_path(input),
      contents: encapsulate_in_gem_module(contents)
    }
  end
end