Class: ThreeScaleToolbox::AttributeFilters::ServiceIDFilterFromServiceRef
- Inherits:
-
Object
- Object
- ThreeScaleToolbox::AttributeFilters::ServiceIDFilterFromServiceRef
- Includes:
- AttributeFilter
- Defined in:
- lib/3scale_toolbox/attribute_filters/service_id_from_ref_filter.rb
Instance Attribute Summary collapse
-
#remote ⇒ Object
readonly
Returns the value of attribute remote.
-
#service_id_key ⇒ Object
readonly
Returns the value of attribute service_id_key.
-
#service_ref ⇒ Object
readonly
Returns the value of attribute service_ref.
Instance Method Summary collapse
- #filter(enumerable) ⇒ Object
-
#initialize(remote, service_ref, service_id_key) ⇒ ServiceIDFilterFromServiceRef
constructor
A new instance of ServiceIDFilterFromServiceRef.
Constructor Details
#initialize(remote, service_ref, service_id_key) ⇒ ServiceIDFilterFromServiceRef
Returns a new instance of ServiceIDFilterFromServiceRef.
8 9 10 11 12 |
# File 'lib/3scale_toolbox/attribute_filters/service_id_from_ref_filter.rb', line 8 def initialize(remote, service_ref, service_id_key) @remote = remote @service_ref = service_ref @service_id_key = service_id_key end |
Instance Attribute Details
#remote ⇒ Object (readonly)
Returns the value of attribute remote.
6 7 8 |
# File 'lib/3scale_toolbox/attribute_filters/service_id_from_ref_filter.rb', line 6 def remote @remote end |
#service_id_key ⇒ Object (readonly)
Returns the value of attribute service_id_key.
6 7 8 |
# File 'lib/3scale_toolbox/attribute_filters/service_id_from_ref_filter.rb', line 6 def service_id_key @service_id_key end |
#service_ref ⇒ Object (readonly)
Returns the value of attribute service_ref.
6 7 8 |
# File 'lib/3scale_toolbox/attribute_filters/service_id_from_ref_filter.rb', line 6 def service_ref @service_ref end |
Instance Method Details
#filter(enumerable) ⇒ Object
14 15 16 17 |
# File 'lib/3scale_toolbox/attribute_filters/service_id_from_ref_filter.rb', line 14 def filter(enumerable) svc_id = find_service enumerable.select { |e| e.key?(service_id_key) && e[service_id_key].to_s == svc_id.to_s } end |