Class: Joiner::JoinAliaser

Inherits:
Object
  • Object
show all
Defined in:
lib/joiner/join_aliaser.rb

Overview

The core logic of this class is old Rails behaviour, replicated here because their own alias logic has evolved, but I haven’t yet found a way to make use of it - and besides, this is only used to generate Thinking Sphinx’s configuration rarely - not in any web requests, so performance issues are less critical here.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(join_root, alias_tracker) ⇒ JoinAliaser

Returns a new instance of JoinAliaser.



12
13
14
15
# File 'lib/joiner/join_aliaser.rb', line 12

def initialize(join_root, alias_tracker)
  @join_root = join_root
  @alias_tracker = alias_tracker
end

Class Method Details

.call(join_root, alias_tracker) ⇒ Object



8
9
10
# File 'lib/joiner/join_aliaser.rb', line 8

def self.call(join_root, alias_tracker)
  new(join_root, alias_tracker).call
end

Instance Method Details

#callObject



17
18
19
20
21
# File 'lib/joiner/join_aliaser.rb', line 17

def call
  join_root.each_children do |parent, child|
    child.table = table_aliases_for(parent, child).first
  end
end