Class: Git::Duo::AuthorCollection
- Inherits:
-
Object
- Object
- Git::Duo::AuthorCollection
- Defined in:
- lib/git/duo/author_collection.rb
Instance Attribute Summary collapse
-
#authors ⇒ Object
readonly
Returns the value of attribute authors.
Instance Method Summary collapse
-
#initialize(authors) ⇒ AuthorCollection
constructor
A new instance of AuthorCollection.
- #where(opts = {}) ⇒ Object
Constructor Details
#initialize(authors) ⇒ AuthorCollection
Returns a new instance of AuthorCollection.
6 7 8 |
# File 'lib/git/duo/author_collection.rb', line 6 def initialize = end |
Instance Attribute Details
#authors ⇒ Object (readonly)
Returns the value of attribute authors.
4 5 6 |
# File 'lib/git/duo/author_collection.rb', line 4 def end |
Instance Method Details
#where(opts = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/git/duo/author_collection.rb', line 10 def where opts = {} result = [] result += opts. select {|k, _| .sample.respond_to? k }. map {|k, v| . sort_by(&:key). select {|o| o.send(k) =~ /#{v}/i } }.flatten rescue NoMethodError result end |