Class: Clinical::Collection

Inherits:
WillPaginate::Collection
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/clinical/collection.rb

Defined Under Namespace

Classes: SearchResult

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#countObject

Returns the value of attribute count.



4
5
6
# File 'lib/clinical/collection.rb', line 4

def count
  @count
end

Class Method Details

.create_from_results(page, per_page, body) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/clinical/collection.rb', line 6

def create_from_results(page, per_page, body)
  results = SearchResult.parse(body)
  col = create(page, per_page, results.count || 0) do |pager|
    pager.replace(results.trials)
  end
  col.count = results.count
  col
end