Sha256: fc42e83de8622796f773c67d4b7c4664503120a16a71a9c1d7a4f388061235f7

Contents?: true

Size: 568 Bytes

Versions: 9

Compression:

Stored size: 568 Bytes

Contents

require 'gh'

module GH
  # Public: ...
  class LazyLoader < Wrapper
    wraps GH::Normalizer
    double_dispatch

    def modify_hash(hash, loaded = false)
      hash = super(hash)
      link = hash['_links']['self'] unless loaded or hash['_links'].nil?
      setup_lazy_loading(hash, link['href']) if link
      hash
    rescue Exception => error
      raise Error.new(error, hash)
    end

    private

    def lazy_load(hash, key, link)
      modify_hash(backend[link].data, true)
    rescue Exception => error
      raise Error.new(error, hash)
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
gh-0.18.0 lib/gh/lazy_loader.rb
gh-0.17.0 lib/gh/lazy_loader.rb
gh-0.16.0 lib/gh/lazy_loader.rb
gh-0.16.0.beta1 lib/gh/lazy_loader.rb
gh-akerl-0.15.1.1 lib/gh/lazy_loader.rb
gh-akerl-0.15.1 lib/gh/lazy_loader.rb
gh-0.15.1 lib/gh/lazy_loader.rb
gh-0.15.0 lib/gh/lazy_loader.rb
gh-0.14.0 lib/gh/lazy_loader.rb