Module: Card::Query::CardQuery::RelationalAttributes

Included in:
Card::Query::CardQuery
Defined in:
lib/card/query/card_query/relational_attributes.rb

Overview

interpret CQL attributes that relate multiple cards each method below corresponds to a relational CQL term

NOTE: methods using “restrict” can be executed without tying in an additional query if the val in question can be reduced to an id.

Instance Method Summary collapse

Instance Method Details

#created_by(val) ⇒ Object



56
57
58
# File 'lib/card/query/card_query/relational_attributes.rb', line 56

def created_by val
  restrict :creator_id, val
end

#creator_of(val) ⇒ Object



52
53
54
# File 'lib/card/query/card_query/relational_attributes.rb', line 52

def creator_of val
  tie :card, val, to: :creator_id
end

#edited_by(val) ⇒ Object



36
37
38
# File 'lib/card/query/card_query/relational_attributes.rb', line 36

def edited_by val
  tie_action :action_by, val
end

#editor_of(val) ⇒ Object



28
29
30
# File 'lib/card/query/card_query/relational_attributes.rb', line 28

def editor_of val
  tie_act :action_on, val
end

#last_edited_by(val) ⇒ Object



48
49
50
# File 'lib/card/query/card_query/relational_attributes.rb', line 48

def last_edited_by val
  restrict :updater_id, val
end

#last_editor_of(val) ⇒ Object



44
45
46
# File 'lib/card/query/card_query/relational_attributes.rb', line 44

def last_editor_of val
  tie :card, val, to: :updater_id
end

#left(val) ⇒ Object



20
21
22
# File 'lib/card/query/card_query/relational_attributes.rb', line 20

def left val
  restrict :left_id, val
end

#left_plus(val) ⇒ Object

~~~~~~ PLUS RELATIONAL



62
63
64
# File 'lib/card/query/card_query/relational_attributes.rb', line 62

def left_plus val
  junction val, :left, :right_id
end

#part(val) ⇒ Object



15
16
17
18
# File 'lib/card/query/card_query/relational_attributes.rb', line 15

def part val
  right_val = val.is_a?(Integer) ? val : val.clone
  any(left: val, right: right_val)
end

#plus(val) ⇒ Object



70
71
72
# File 'lib/card/query/card_query/relational_attributes.rb', line 70

def plus val
  any(left_plus: val, right_plus: val.deep_clone)
end

#right(val) ⇒ Object



24
25
26
# File 'lib/card/query/card_query/relational_attributes.rb', line 24

def right val
  restrict :right_id, val
end

#right_plus(val) ⇒ Object



66
67
68
# File 'lib/card/query/card_query/relational_attributes.rb', line 66

def right_plus val
  junction val, :right, :left_id
end

#type(val) ⇒ Object



11
12
13
# File 'lib/card/query/card_query/relational_attributes.rb', line 11

def type val
  restrict :type_id, val
end

#updated_by(val) ⇒ Object



40
41
42
# File 'lib/card/query/card_query/relational_attributes.rb', line 40

def updated_by val
  tie_action :update_action_by, val
end

#updater_of(val) ⇒ Object



32
33
34
# File 'lib/card/query/card_query/relational_attributes.rb', line 32

def updater_of val
  tie_act :update_action_on, val
end