Module: Card::Query::CardQuery::ReferenceAttributes

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

Overview

interpret CQL attributes that involve references from one card to another

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.define_reference_method(methodname, reftype, ref_method, ref_field) ⇒ Object



6
7
8
9
10
11
12
# File 'card/lib/card/query/card_query/reference_attributes.rb', line 6

def self.define_reference_method methodname, reftype, ref_method, ref_field
  define_method methodname do |val|
    tie :reference,
        { ref_method => { reftype: reftype, card: val } },
        to: ref_field
  end
end

Instance Method Details

#member(val) ⇒ Object



39
40
41
# File 'card/lib/card/query/card_query/reference_attributes.rb', line 39

def member val
  interpret referred_to_by: { left: val, right: Card::RolesID }
end

#member_of(val) ⇒ Object

shortcut methods for role references DEPRECATE?



35
36
37
# File 'card/lib/card/query/card_query/reference_attributes.rb', line 35

def member_of val
  interpret right_plus: [Card::RolesID, { refer_to: val }]
end