Class: Hanami::RSpec::Generators::Operation Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/rspec/generators/operation.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fs:, inflector:) ⇒ Operation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Operation.

Since:

  • 2.0.0



12
13
14
15
# File 'lib/hanami/rspec/generators/operation.rb', line 12

def initialize(fs:, inflector:)
  @fs = fs
  @inflector = inflector
end

Instance Attribute Details

#fsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



10
11
12
# File 'lib/hanami/rspec/generators/operation.rb', line 10

def fs
  @fs
end

#inflectorObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



10
11
12
# File 'lib/hanami/rspec/generators/operation.rb', line 10

def inflector
  @inflector
end

Instance Method Details

#call(key:, namespace:, base_path:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



17
18
19
20
21
22
23
# File 'lib/hanami/rspec/generators/operation.rb', line 17

def call(key:, namespace:, base_path:)
  operation_class_file = operation_class_file(key:, namespace:, base_path:)
  spec_file_path = operation_class_file.path.gsub(/\.rb$/, "_spec.rb")
  operation_class_name = operation_class_file.fully_qualified_name

  fs.write(spec_file_path, spec_content(operation_class_name))
end