Module: Fetching::FetchingArray::ArrayMethods

Included in:
Fetching::FetchingArray
Defined in:
lib/fetching/fetching_array.rb

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/fetching/fetching_array.rb', line 28

def empty?
  @table.empty?
end

#lengthObject Also known as: size



32
33
34
# File 'lib/fetching/fetching_array.rb', line 32

def length
  @table.length
end

#reverseObject



37
38
39
# File 'lib/fetching/fetching_array.rb', line 37

def reverse
  Fetching.from @table.reverse
end

#shuffle(*args) ⇒ Object



41
42
43
# File 'lib/fetching/fetching_array.rb', line 41

def shuffle(*args)
  Fetching.from @table.shuffle(*args)
end

#sort(&block) ⇒ Object



45
46
47
# File 'lib/fetching/fetching_array.rb', line 45

def sort(&block)
  Fetching.from @table.sort(&block)
end

#sort_by(&block) ⇒ Object



49
50
51
# File 'lib/fetching/fetching_array.rb', line 49

def sort_by(&block)
  Fetching.from @table.sort_by(&block)
end

#values_at(*args) ⇒ Object



53
54
55
56
57
# File 'lib/fetching/fetching_array.rb', line 53

def values_at(*args)
  results = args.map { |arg| result_for_argument(arg) }.flatten

  Fetching.from(results)
end