Class: Diaspora::Cluster::Creator::AttributeCollectionFactory

Inherits:
Object
  • Object
show all
Extended by:
DependencyInjector
Defined in:
lib/diaspora-cluster-creator/attribute_collection_factory.rb

Constant Summary collapse

DEFAULT_ATTRIBUTE_NAMES =
[
  "Technology",
  "Resources",
  "Environment",
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster) ⇒ AttributeCollectionFactory

Returns a new instance of AttributeCollectionFactory.



15
16
17
# File 'lib/diaspora-cluster-creator/attribute_collection_factory.rb', line 15

def initialize(cluster)
  @cluster = cluster
end

Instance Attribute Details

#clusterObject (readonly)

Returns the value of attribute cluster.



14
15
16
# File 'lib/diaspora-cluster-creator/attribute_collection_factory.rb', line 14

def cluster
  @cluster
end

Instance Method Details

#build_from(names = []) ⇒ Object



19
20
21
22
23
24
# File 'lib/diaspora-cluster-creator/attribute_collection_factory.rb', line 19

def build_from(names = [])
  from_these_names = (!names.nil? && names.any?) ? names : DEFAULT_ATTRIBUTE_NAMES
  from_these_names.each_with_object([]) do |name, mem|
    mem << attribute_builder.call(name)
  end
end