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

Included in:
Card::Query::CardQuery
Defined in:
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 '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
42
# File 'lib/card/query/card_query/reference_attributes.rb', line 39

def member val
  interpret type_id: Card::RoleID,
            right_plus: [{ codename: "members" }, refer_to: val]
end

#member_of(val) ⇒ Object

shortcut methods for role references DEPRECATE?



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

def member_of val
  interpret referred_to_by: { left: val, right: { codename: "members" } }
end