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