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



37
38
39
# File 'lib/card/query/card_query/reference_attributes.rb', line 37

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

#member_of(val) ⇒ Object

shortcut methods for role references DEPRECATE?



33
34
35
# File 'lib/card/query/card_query/reference_attributes.rb', line 33

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