Class: OodAppkit::Clusters

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ood_appkit/clusters.rb

Overview

An enumerable that holds a list of ClusterDecorator objects

Instance Method Summary collapse

Constructor Details

#initialize(clusters = []) ⇒ Clusters



7
8
9
# File 'lib/ood_appkit/clusters.rb', line 7

def initialize(clusters = [])
  @clusters = clusters
end

Instance Method Details

#[](id) ⇒ ClusterDecorator?

Find object in list from object’s id



14
15
16
# File 'lib/ood_appkit/clusters.rb', line 14

def [](id)
  @clusters.detect { |v| v == id }
end

#each {|obj| ... } ⇒ Object

Iterate over each of the clusters

Yields:

  • (obj)

    cluster decorator objects



20
21
22
# File 'lib/ood_appkit/clusters.rb', line 20

def each(&block)
  @clusters.each(&block)
end