Method: Fetching.from

Defined in:
lib/fetching.rb

.from(value) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/fetching.rb', line 22

def self.from(value)
  case value
  when ->(v) { v.respond_to? :to_ary }
    FetchingArray.new(value.to_ary)
  when ->(v) { v.respond_to? :to_hash }
    FetchingHash.new(value.to_hash)
  else
    value
  end
end