Class: Rews::Folder::FindResult
- Inherits:
-
Object
- Object
- Rews::Folder::FindResult
- Defined in:
- lib/rews/folder.rb
Overview
find_*
methods on Folder::BaseFolderId
return a FindResult
Constant Summary collapse
- VIEW_ATTRS =
[:includes_last_item_in_range, :indexed_paging_offset, :total_items_in_view]
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
the
result
of thefind_*
call.
Instance Method Summary collapse
-
#[](key) ⇒ Object
access an element from
result
. - #first ⇒ Object
-
#initialize(view, &proc) ⇒ FindResult
constructor
A new instance of FindResult.
- #inspect ⇒ Object
- #last ⇒ Object
-
#length ⇒ Object
count of items in the
result
. -
#size ⇒ Object
alias for
length
.
Constructor Details
#initialize(view, &proc) ⇒ FindResult
Returns a new instance of FindResult.
51 52 53 54 55 56 |
# File 'lib/rews/folder.rb', line 51 def initialize(view, &proc) VIEW_ATTRS.each do |attr| self.instance_variable_set("@#{attr}", view[attr]) end @result = proc.call(view) if proc end |
Instance Attribute Details
#result ⇒ Object (readonly)
the result
of the find_*
call
49 50 51 |
# File 'lib/rews/folder.rb', line 49 def result @result end |
Instance Method Details
#[](key) ⇒ Object
access an element from result
69 70 71 |
# File 'lib/rews/folder.rb', line 69 def [](key) result[key] end |
#first ⇒ Object
73 74 75 |
# File 'lib/rews/folder.rb', line 73 def first result.first end |
#inspect ⇒ Object
81 82 83 84 |
# File 'lib/rews/folder.rb', line 81 def inspect attrs = VIEW_ATTRS.map{|attr| "@#{attr}=#{self.send(attr)}"}.join(", ") "#<#{self.class} #{attrs}, @result=#{@result.inspect}>" end |
#last ⇒ Object
77 78 79 |
# File 'lib/rews/folder.rb', line 77 def last result.last end |
#length ⇒ Object
count of items in the result
59 60 61 |
# File 'lib/rews/folder.rb', line 59 def length result.length end |
#size ⇒ Object
alias for length
64 65 66 |
# File 'lib/rews/folder.rb', line 64 def size result.size end |