Module: PassionView::Relation
- Defined in:
- lib/passion_view/relation.rb
Instance Method Summary collapse
- #count ⇒ Object
- #empty? ⇒ Boolean
- #first ⇒ Object
- #include?(obj) ⇒ Boolean
-
#items ⇒ Object
delegate :to_sql, :offset_value, :total_count, :limit_value, to: :scoped.
- #last ⇒ Object
- #limit_value ⇒ Object
- #offset_value ⇒ Object
- #size ⇒ Object
- #to_sql ⇒ Object
- #total_count ⇒ Object
Instance Method Details
#count ⇒ Object
27 28 29 |
# File 'lib/passion_view/relation.rb', line 27 def count items.count end |
#empty? ⇒ Boolean
39 40 41 |
# File 'lib/passion_view/relation.rb', line 39 def empty? items.empty? end |
#first ⇒ Object
19 20 21 |
# File 'lib/passion_view/relation.rb', line 19 def first item_view_model(items.first) end |
#include?(obj) ⇒ Boolean
35 36 37 |
# File 'lib/passion_view/relation.rb', line 35 def include?(obj) items.include?(obj) end |
#items ⇒ Object
delegate :to_sql,
:offset_value,
:total_count,
:limit_value,
to: :scoped
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/passion_view/relation.rb', line 8 def items case (items = super) when ActiveRecord::Relation items when ActiveRecord::Base items.where(nil) else raise TypeError, "not an ActiveRecord object: #{items.class}" end end |
#last ⇒ Object
23 24 25 |
# File 'lib/passion_view/relation.rb', line 23 def last item_view_model(items.first) end |
#limit_value ⇒ Object
55 56 57 |
# File 'lib/passion_view/relation.rb', line 55 def limit_value items.limit_value end |
#offset_value ⇒ Object
47 48 49 |
# File 'lib/passion_view/relation.rb', line 47 def offset_value items.offset_value end |
#size ⇒ Object
31 32 33 |
# File 'lib/passion_view/relation.rb', line 31 def size items.size end |
#to_sql ⇒ Object
43 44 45 |
# File 'lib/passion_view/relation.rb', line 43 def to_sql items.to_sql end |
#total_count ⇒ Object
51 52 53 |
# File 'lib/passion_view/relation.rb', line 51 def total_count items.total_count end |