Class: AnyLogin::Collection
- Inherits:
-
Object
- Object
- AnyLogin::Collection
- Defined in:
- lib/any_login/collection.rb
Instance Attribute Summary collapse
-
#collection_raw ⇒ Object
readonly
Returns the value of attribute collection_raw.
Instance Method Summary collapse
- #grouped? ⇒ Boolean
-
#initialize(collection_raw) ⇒ Collection
constructor
A new instance of Collection.
- #to_a ⇒ Object
Constructor Details
#initialize(collection_raw) ⇒ Collection
Returns a new instance of Collection.
5 6 7 |
# File 'lib/any_login/collection.rb', line 5 def initialize(collection_raw) @collection_raw = collection_raw end |
Instance Attribute Details
#collection_raw ⇒ Object (readonly)
Returns the value of attribute collection_raw.
3 4 5 |
# File 'lib/any_login/collection.rb', line 3 def collection_raw @collection_raw end |
Instance Method Details
#grouped? ⇒ Boolean
9 10 11 |
# File 'lib/any_login/collection.rb', line 9 def grouped? type == :grouped end |
#to_a ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/any_login/collection.rb', line 13 def to_a collection_raw.collect do |e| if grouped? [e[0], e[1].collect(&AnyLogin.name_method)] else if AnyLogin.name_method.is_a?(Symbol) e.send(AnyLogin.name_method) else AnyLogin.name_method.call(e) end end end end |