Class: Fetching::FetchingArray

Inherits:
Fetching
  • Object
show all
Includes:
Enumerable, ArrayMethods
Defined in:
lib/fetching/fetching_array.rb

Defined Under Namespace

Modules: ArrayMethods

Constant Summary

Constants inherited from Fetching

VERSION, WHITELIST

Instance Method Summary collapse

Methods included from ArrayMethods

#empty?, #length, #reverse, #shuffle, #sort, #sort_by, #values_at

Methods inherited from Fetching

#==, from, from_json, #hash, #initialize, #inspect, #to_fetching, #to_s

Constructor Details

This class inherits a constructor from Fetching

Instance Method Details

#[](index) ⇒ Object



6
7
8
# File 'lib/fetching/fetching_array.rb', line 6

def [](index)
  Fetching.from @table.fetch(index)
end

#eachObject



10
11
12
13
14
# File 'lib/fetching/fetching_array.rb', line 10

def each
  @table.each_index do |i|
    yield self[i]
  end
end

#firstObject



16
17
18
# File 'lib/fetching/fetching_array.rb', line 16

def first
  self[0]
end