Class: CMIS::Children
- Inherits:
-
Object
- Object
- CMIS::Children
- Defined in:
- lib/cmis/children.rb
Instance Method Summary collapse
-
#each_child(options = {}, &block) ⇒ Object
Options: limit.
-
#each_page(options = {}, &block) ⇒ Object
Options: limit.
- #has_next? ⇒ Boolean
-
#initialize(folder, options = {}) ⇒ Children
constructor
Options: from, page_size.
- #results ⇒ Object
- #total ⇒ Object
Constructor Details
#initialize(folder, options = {}) ⇒ Children
Options: from, page_size
7 8 9 10 11 12 |
# File 'lib/cmis/children.rb', line 7 def initialize(folder, = {}) @folder = folder @options = .symbolize_keys end |
Instance Method Details
#each_child(options = {}, &block) ⇒ Object
Options: limit
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cmis/children.rb', line 15 def each_child( = {}, &block) return enum_for(:each_child, ) unless block_given? limit = parse_limit() return if limit == 0 counter = 0 while has_next? results.each do |object| yield object counter = counter.next return unless counter < limit end end end |
#each_page(options = {}, &block) ⇒ Object
Options: limit
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/cmis/children.rb', line 33 def each_page( = {}, &block) return enum_for(:each_page, ) unless block_given? limit = parse_limit() counter = 0 while has_next? break unless counter < limit yield r = results counter += r.size end end |
#has_next? ⇒ Boolean
57 58 59 |
# File 'lib/cmis/children.rb', line 57 def has_next? @has_next end |
#results ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/cmis/children.rb', line 47 def results result = do_get_children @skip_count += result.results.size @has_next = result.has_more_items @total = result.num_items result.results end |
#total ⇒ Object
61 62 63 |
# File 'lib/cmis/children.rb', line 61 def total @total ||= do_get_children.num_items end |