Module: Babeltrace2Gen::BTMatch
- Included in:
- BTEntryClass, BTEventClass, BTFieldClass, BTMemberClass, BTStreamClass, BTTraceClass
- Defined in:
- lib/metababel/bt2_matching_utils.rb
Instance Method Summary collapse
Instance Method Details
#match?(match_obj) ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/metababel/bt2_matching_utils.rb', line 15 def match?(match_obj) attrs_syms = self.class::BT_MATCH_ATTRS attrs = attrs_syms.map do |attr_sym| match_attr = match_obj.send(attr_sym) # In the model, but not in the match, assuming True next true if match_attr.nil? self_attr = send(attr_sym) # Not matching because in the match but not in the model next false if self_attr.nil? # Continue the recursion self_attr.match?(match_attr) end.flatten return false unless attrs.all? attrs.filter { |a| a.is_a?(Babeltrace2Gen::GeneratedArg) } end |