Class: PathNode

Inherits:
String
  • Object
show all
Defined in:
lib/sequel/plugins/join_by_paths.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, start_model) ⇒ PathNode

Returns a new instance of PathNode.



12
13
14
15
# File 'lib/sequel/plugins/join_by_paths.rb', line 12

def initialize(str, start_model)
  super(str)
  @start_model = start_model
end

Instance Attribute Details

#model_classObject

Returns the value of attribute model_class.



9
10
11
# File 'lib/sequel/plugins/join_by_paths.rb', line 9

def model_class
  @model_class
end

#path_strObject

Returns the value of attribute path_str.



10
11
12
# File 'lib/sequel/plugins/join_by_paths.rb', line 10

def path_str
  @path_str
end

Instance Method Details

#alias_symObject



25
26
27
# File 'lib/sequel/plugins/join_by_paths.rb', line 25

def alias_sym
  @start_model.get_alias_sym(path_str)
end

#set_model_class_by_parent_model(pmclass) ⇒ Object



21
22
23
# File 'lib/sequel/plugins/join_by_paths.rb', line 21

def set_model_class_by_parent_model(pmclass)
  @model_class = pmclass.association_reflection(to_sym)[:class_name].constantize
end

#table_nameObject



17
18
19
# File 'lib/sequel/plugins/join_by_paths.rb', line 17

def table_name
  @model_class.table_name
end