Module: Contentful::Resource::ArrayLike
Overview
Useful methods for array-like resources that can be included if an :items property exists
Instance Method Summary collapse
-
#array? ⇒ true
Returns true for array-like resources.
-
#each_item {|Contentful::Entry, Contentful::Asset| ... } ⇒ Object
(also: #each)
Delegates to items#each.
-
#empty? ⇒ Boolean
Delegates to items#empty?.
-
#size ⇒ Number
(also: #length)
Delegetes to items#size.
Instance Method Details
#array? ⇒ true
Returns true for array-like resources
11 12 13 |
# File 'lib/contentful/resource/array_like.rb', line 11 def array? true end |
#each_item {|Contentful::Entry, Contentful::Asset| ... } ⇒ Object Also known as: each
Delegates to items#each
18 19 20 |
# File 'lib/contentful/resource/array_like.rb', line 18 def each_item(&block) items.each(&block) end |
#empty? ⇒ Boolean
Delegates to items#empty?
26 27 28 |
# File 'lib/contentful/resource/array_like.rb', line 26 def empty? items.empty? end |
#size ⇒ Number Also known as: length
Delegetes to items#size
33 34 35 |
# File 'lib/contentful/resource/array_like.rb', line 33 def size items.size end |