Class: CoPlan::Plans::PositionResolver
- Inherits:
-
Object
- Object
- CoPlan::Plans::PositionResolver
- Defined in:
- app/services/coplan/plans/position_resolver.rb
Defined Under Namespace
Classes: Resolution
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(content:, operation:) ⇒ PositionResolver
constructor
A new instance of PositionResolver.
Constructor Details
#initialize(content:, operation:) ⇒ PositionResolver
Returns a new instance of PositionResolver.
10 11 12 13 |
# File 'app/services/coplan/plans/position_resolver.rb', line 10 def initialize(content:, operation:) @content = content @op = operation.transform_keys(&:to_s) end |
Class Method Details
.call(content:, operation:) ⇒ Object
6 7 8 |
# File 'app/services/coplan/plans/position_resolver.rb', line 6 def self.call(content:, operation:) new(content:, operation:).call end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/coplan/plans/position_resolver.rb', line 15 def call case @op["op"] when "replace_exact" resolve_replace_exact when "insert_under_heading" resolve_insert_under_heading when "delete_paragraph_containing" resolve_delete_paragraph_containing else raise OperationError, "Unknown operation: #{@op["op"]}" end end |