class Contentstack::EntryCollection
Attributes
content_type[R]
count[R]
entries[R]
schema[R]
Public Class Methods
new(json, content_type_uid=nil)
click to toggle source
# File lib/contentstack/entry_collection.rb, line 7 def initialize(json, content_type_uid=nil) @count = json["count"] if json["count"] @entries = json["entries"].collect{|entry| Entry.new(entry, content_type_uid) } @schema = json["schema"].symbolize_keys if json["schema"] @content_type = json["content_type"].symbolize_keys if json["content_type"] self end
Public Instance Methods
collect(&block)
click to toggle source
# File lib/contentstack/entry_collection.rb, line 23 def collect &block self.each(&block) end
each(&block)
click to toggle source
# File lib/contentstack/entry_collection.rb, line 15 def each &block @entries.map{|e| block.call(e)} end
first()
click to toggle source
# File lib/contentstack/entry_collection.rb, line 31 def first @entries.first end
get(index)
click to toggle source
# File lib/contentstack/entry_collection.rb, line 39 def get(index) @entries[index] end
last()
click to toggle source
# File lib/contentstack/entry_collection.rb, line 35 def last @entries.last end
length()
click to toggle source
# File lib/contentstack/entry_collection.rb, line 27 def length @entries.length end
map(&block)
click to toggle source
# File lib/contentstack/entry_collection.rb, line 19 def map &block self.each(&block) end