Class: Kahuna::MemberCollection
- Inherits:
-
Object
- Object
- Kahuna::MemberCollection
- Includes:
- Enumerable
- Defined in:
- lib/kahuna/member_collection.rb
Constant Summary collapse
- EVENTS =
%w(member-join member-leave member-failed)
Instance Attribute Summary collapse
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(data) ⇒ MemberCollection
constructor
A new instance of MemberCollection.
- #length ⇒ Object
Constructor Details
#initialize(data) ⇒ MemberCollection
Returns a new instance of MemberCollection.
11 12 13 14 |
# File 'lib/kahuna/member_collection.rb', line 11 def initialize(data) @raw_data = data members_from_data raw_data end |
Instance Attribute Details
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
9 10 11 |
# File 'lib/kahuna/member_collection.rb', line 9 def raw_data @raw_data end |
Instance Method Details
#each(&block) ⇒ Object
16 17 18 19 20 |
# File 'lib/kahuna/member_collection.rb', line 16 def each(&block) members.each do |member| block.call member end end |
#empty? ⇒ Boolean
22 23 24 |
# File 'lib/kahuna/member_collection.rb', line 22 def empty? length == 0 end |
#length ⇒ Object
26 27 28 |
# File 'lib/kahuna/member_collection.rb', line 26 def length members.length end |