Module: Claire::Client::Listable::ClassMethods

Defined in:
lib/claire_client/listable.rb

Instance Method Summary collapse

Instance Method Details

#all(&block) ⇒ Object

Returns a Claire::List on its base_url. if passed a block, gets the list, them applies a local filter to the received items, returning an Array.



10
11
12
13
14
15
16
17
18
19
# File 'lib/claire_client/listable.rb', line 10

def all &block          
  list = List.new(self.base_url, self)
  return list unless block
  items = []         
  list.each do |item|
    items << item if yield(item)            
  end
  items    
            
end