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
-
#array? ⇒ Boolean
Returns true for array-like resources.
-
#each_item(&block) ⇒ Object
(also: #each)
Delegates to items#each.
-
#empty? ⇒ Boolean
Delegates to items#empty?.
-
#size ⇒ Object
(also: #length)
Delegetes to items#size.
Instance Method Details
#array? ⇒ Boolean
Returns true for array-like resources
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?
24 25 26 |
# File 'lib/contentful/management/resource/array_like.rb', line 24 def empty? items.empty? end |
#size ⇒ Object 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 |