Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions config/reek.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ DuplicateMethodCall:
max_calls: 1
FeatureEnvy:
enabled: true
exclude:
- 'ROM::Mapping#build_relation'
IrresponsibleModule:
enabled: true
exclude: []
Expand Down
3 changes: 1 addition & 2 deletions lib/rom/mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ def method_missing(name, *, &block)
#
# @api private
def build_relation(relation, &block)
definition = Definition.build(relation.header, &block)
environment[relation.name] = Relation.build(relation, definition.mapper)
environment[relation.name] = Relation.build_from(relation, &block)
end

end # Mapping
Expand Down
12 changes: 12 additions & 0 deletions lib/rom/relation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ def self.build(relation, mapper)
new(mapper.call(relation), mapper)
end

# Build a new relation from a given relation
#
# @param [Axiom::Relation]
#
# @return [Relation]
#
# @api publi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mispelled, it should be @api public.

def self.build_from(relation, &block)
definition = Mapping::Definition.build(relation.header, &block)
Relation.build(relation, definition.mapper)
end

# Iterate over tuples yielded by the wrapped relation
#
# @example
Expand Down