Module: Nova::Common::Features::ClassMethods

Included in:
Star
Defined in:
lib/nova/common/features.rb

Overview

Class methods.

Instance Method Summary collapse

Instance Method Details

#feature(name, options = {}) { ... } ⇒ Feature

Define a feature, with the given name and block.

Parameters:

  • name (Symbol)

    the name of the feature.

  • options (Hash) (defaults to: {})

    the options for the feature.

Yields:

  • to create the feature.

Returns:

  • (Feature)

    the feature that was defined.



37
38
39
40
41
# File 'lib/nova/common/features.rb', line 37

def feature(name, options = {}, &block)
  new_feature = Feature.new(name, options)
  new_feature.instance_exec &block
  features[name] = new_feature
end

#featuresHash

The list of features the star supports.

Returns:

  • (Hash)

    the features.



20
21
22
# File 'lib/nova/common/features.rb', line 20

def features
  @features ||= {}
end

#supports?(feature_name) ⇒ Boolean

Whether or not this star supports a feature.

Returns:

  • (Boolean)


27
28
29
# File 'lib/nova/common/features.rb', line 27

def supports?(feature_name)
  features.key? feature_name
end