Class: Ruby::Rego::WithModifiers::WithModifierPathOverride

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/rego/with_modifiers/with_modifier_path_override.rb

Overview

Applies a path-based override to a Ruby object. :reek:DataClump :reek:FeatureEnvy :reek:TooManyStatements :reek:DuplicateMethodCall

Instance Method Summary collapse

Constructor Details

#initialize(base_value:, keys:, replacement:, location: nil) ⇒ WithModifierPathOverride

Returns a new instance of WithModifierPathOverride.

Parameters:

  • base_value (Object)
  • keys (Array<Object>)
  • replacement (Object)
  • location (Location, nil) (defaults to: nil)


18
19
20
21
22
23
# File 'lib/ruby/rego/with_modifiers/with_modifier_path_override.rb', line 18

def initialize(base_value:, keys:, replacement:, location: nil)
  @base_value = base_value
  @keys = keys
  @replacement = replacement
  @location = location
end

Instance Method Details

#applyObject

Returns:

  • (Object)


26
27
28
# File 'lib/ruby/rego/with_modifiers/with_modifier_path_override.rb', line 26

def apply
  apply_to(base_value, keys)
end