Class: Uniword::Transformation::NullTransformationRule

Inherits:
TransformationRule show all
Defined in:
lib/uniword/transformation/transformation_rule.rb

Overview

Null transformation rule (fallback when no rule matches)

Returns element unchanged - useful as default behavior

Instance Attribute Summary

Attributes inherited from TransformationRule

#source_format, #target_format

Instance Method Summary collapse

Constructor Details

#initializeNullTransformationRule

Returns a new instance of NullTransformationRule.



77
78
79
# File 'lib/uniword/transformation/transformation_rule.rb', line 77

def initialize
  super(source_format: :any, target_format: :any)
end

Instance Method Details

#matches?(element_type:, source_format:, target_format:) ⇒ Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/uniword/transformation/transformation_rule.rb', line 81

def matches?(element_type:, source_format:, target_format:)
  true # Matches anything (fallback)
end

#transform(element) ⇒ Object



85
86
87
88
# File 'lib/uniword/transformation/transformation_rule.rb', line 85

def transform(element)
  # No transformation - deep copy element to avoid mutations
  element.class.new(element.to_h)
end