Class: CMIS::Relationships

Inherits:
Object
  • Object
show all
Defined in:
lib/cmis/relationships.rb

Instance Method Summary collapse

Constructor Details

#initialize(object, options = {}) ⇒ Relationships

Options: from, page_size



4
5
6
7
8
9
# File 'lib/cmis/relationships.rb', line 4

def initialize(object, options = {})
  @object = object
  @options = options.stringify_keys!

  init_options
end

Instance Method Details

#each_page(options = {}, &block) ⇒ Object

Options: limit



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cmis/relationships.rb', line 29

def each_page(options = {}, &block)
  return enum_for(:each_page, options) unless block_given?

  init_options
  limit = parse_limit(options)
  counter = 0

  while has_next?
    break unless counter < limit
    yield r = results
    counter += r.size
  end
end

#each_relationship(options = {}, &block) ⇒ Object

Options: limit



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cmis/relationships.rb', line 12

def each_relationship(options = {}, &block)
  return enum_for(:each_relationship, options) unless block_given?

  init_options
  limit = parse_limit(options)
  counter = 0

  while has_next?
    results.each do |object|
      break unless counter < limit
      yield object
      counter = counter.next
    end
  end
end

#has_next?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/cmis/relationships.rb', line 53

def has_next?
  @has_next
end

#resultsObject



43
44
45
46
47
48
49
50
51
# File 'lib/cmis/relationships.rb', line 43

def results
  result = do_get_relationships

  @skip_count += result.results.size
  @has_next = result.has_more_items
  @total = result.num_items

  result.results
end

#totalObject



57
58
59
# File 'lib/cmis/relationships.rb', line 57

def total
  @total ||= do_get_relationships.num_items
end