class Babik::Selection::Path::Factory

Represents a factory class for ForeignPath & LocalPath

Public Class Methods

build(model, selection_path) click to toggle source

Factory Method used to create local and foreign selections

# File lib/babik/queryset/lib/selection/path/path.rb, line 14
def self.build(model, selection_path)
  is_foreign = selection_path.match?(Babik::Selection::Config::RELATIONSHIP_SEPARATOR)
  return Babik::Selection::Path::ForeignPath.new(model, selection_path) if is_foreign
  Babik::Selection::Path::LocalPath.new(model, selection_path)
end