Class: Ast::Merge::Ruleset::SupportStyleResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/ast/merge/ruleset/support_style_resolver.rb

Overview

Bridges parsed ruleset read strategies to runtime support-style objects.

Class Method Summary collapse

Class Method Details

.call(read:, source:, capability:, style:) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ast/merge/ruleset/support_style_resolver.rb', line 9

def call(read:, source:, capability:, style:)
  case read
  when :source_augmented_portable_write
    Comment::SupportStyle.source_augmented_portable_write(
      source: source,
      capability: capability,
      style: style
    )
  when :native_read_portable_write
    Comment::SupportStyle.native_read_portable_write(
      source: source,
      capability: capability,
      style: style
    )
  when :native_mutation
    Comment::SupportStyle.native_mutation(
      source: source,
      capability: capability,
      style: style
    )
  else
    raise ArgumentError, "Unknown ruleset read strategy: #{read.inspect}"
  end
end