Module: HealthCards::PayloadTypes
- Included in:
- Payload
- Defined in:
- lib/health_cards/payload_types.rb
Overview
Handles behavior related to support types by Payload subclasses
Instance Method Summary collapse
-
#additional_types(*add_types) ⇒ Array
Additional type claims this Payload class supports if used as a getter.
-
#supports_type?(*type) ⇒ Boolean
Check if this class supports the given type claim(s).
-
#types ⇒ Array
Type claims supported by this Payload subclass.
Instance Method Details
#additional_types(*add_types) ⇒ Array
Additional type claims this Payload class supports if used as a getter
10 11 12 13 14 |
# File 'lib/health_cards/payload_types.rb', line 10 def additional_types(*add_types) @additional_types ||= [] @additional_types.concat(add_types) unless add_types.nil? @additional_types end |
#supports_type?(*type) ⇒ Boolean
Check if this class supports the given type claim(s)
25 26 27 |
# File 'lib/health_cards/payload_types.rb', line 25 def supports_type?(*type) !types.intersection(type.flatten).empty? end |
#types ⇒ Array
Type claims supported by this Payload subclass
18 19 20 |
# File 'lib/health_cards/payload_types.rb', line 18 def types @types ||= self == HealthCards::Payload ? additional_types : superclass.types + additional_types end |