Class: Portage::Ucp::Capability
- Inherits:
-
Object
- Object
- Portage::Ucp::Capability
- Defined in:
- lib/portage/ucp/capability.rb
Overview
A named, versioned UCP capability (e.g. "dev.ucp.shopping.catalog") mapping UCP action names to the Adapter methods that back them.
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#advertised_for?(adapter) ⇒ Boolean
Advertised only if at least one backing Adapter method is overridden — see Portage::Ucp::Adapter for why (contract can grow without breaking adapters).
-
#initialize(name:, version:, actions:) ⇒ Capability
constructor
A new instance of Capability.
Constructor Details
#initialize(name:, version:, actions:) ⇒ Capability
Returns a new instance of Capability.
8 9 10 11 12 |
# File 'lib/portage/ucp/capability.rb', line 8 def initialize(name:, version:, actions:) @name = name @version = version @actions = actions end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
6 7 8 |
# File 'lib/portage/ucp/capability.rb', line 6 def actions @actions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/portage/ucp/capability.rb', line 6 def name @name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/portage/ucp/capability.rb', line 6 def version @version end |
Instance Method Details
#advertised_for?(adapter) ⇒ Boolean
Advertised only if at least one backing Adapter method is overridden — see Portage::Ucp::Adapter for why (contract can grow without breaking adapters).
16 17 18 |
# File 'lib/portage/ucp/capability.rb', line 16 def advertised_for?(adapter) actions.values.any? { |method_name| overridden?(adapter, method_name) } end |