Class: Portage::Ucp::Capability

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#actionsObject (readonly)

Returns the value of attribute actions.



6
7
8
# File 'lib/portage/ucp/capability.rb', line 6

def actions
  @actions
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/portage/ucp/capability.rb', line 6

def name
  @name
end

#versionObject (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).

Returns:

  • (Boolean)


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