Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HashMapper.import_mapper #27

Merged
merged 1 commit into from
May 24, 2024
Merged

HashMapper.import_mapper #27

merged 1 commit into from
May 24, 2024

Conversation

ismasan
Copy link
Owner

@ismasan ismasan commented May 24, 2024

Importing mappings from another mapper

Use .import_mapper(another_mapper) to import mappings from another mapper. This is useful when you want to reuse mappings from another mapper.

class Mapper1
  extend HashMapper
  map from('/name'), to('/name')
end

class Mapper2
  extend HashMapper
  import_mapper Mapper1
  map from('/age'), to('/age')
end

# Mapper2 will have mappings from Mapper1 ('/name' => '/name') and its own mappings ('/age' => '/age')

@ismasan ismasan merged commit dbf3c9e into master May 24, 2024
1 check passed
@ismasan ismasan deleted the import_mapper branch May 24, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant