Module: Contentful::Management::Resource::ArrayLike

Includes:
Enumerable
Included in:
Array
Defined in:
lib/contentful/management/resource/array_like.rb

Overview

Useful methods for array-like resources that can be included if an

#items

property exists

Instance Method Summary collapse

Instance Method Details

#array?Boolean

Returns true for array-like resources

Returns:

  • (Boolean)


12
13
14
# File 'lib/contentful/management/resource/array_like.rb', line 12

def array?
  true
end

#each_item(&block) ⇒ Object Also known as: each

Delegates to items#each



17
18
19
# File 'lib/contentful/management/resource/array_like.rb', line 17

def each_item(&block)
  items.each(&block)
end

#empty?Boolean

Delegates to items#empty?

Returns:

  • (Boolean)


24
25
26
# File 'lib/contentful/management/resource/array_like.rb', line 24

def empty?
  items.empty?
end

#sizeObject Also known as: length

Delegetes to items#size



29
30
31
# File 'lib/contentful/management/resource/array_like.rb', line 29

def size
  items.size
end