class Mastodon::Collection
Mastodon
collections. Used in place of arrays.
Public Class Methods
new(items, klass)
click to toggle source
# File lib/mastodon/collection.rb, line 8 def initialize(items, klass) @collection = items.map { |attributes| klass.new(attributes) } end
Public Instance Methods
each(start = 0) { |element| ... }
click to toggle source
# File lib/mastodon/collection.rb, line 12 def each(start = 0) return to_enum(:each, start) unless block_given? Array(@collection[start..-1]).each do |element| yield(element) end self end
last()
click to toggle source
# File lib/mastodon/collection.rb, line 26 def last @collection.last end
size()
click to toggle source
# File lib/mastodon/collection.rb, line 22 def size @collection.size end