Sha256: 0c261f0a85c1a5edb5f8d4e7080e1be77fba2471c61a1bf98ea9036d8face9fe

Contents?: true

Size: 500 Bytes

Versions: 2

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

module Frise
  class Loader
    # A basic proxy object.
    class Lazy < BasicObject
      def initialize(&callable)
        @callable = callable
      end

      def __target_object__
        @__target_object__ ||= @callable.call
      end

      # rubocop:disable Style/MethodMissing
      def method_missing(method_name, *args, &block)
        __target_object__.send(method_name, *args, &block)
      end
      # rubocop:enable Style/MethodMissing
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frise-0.3.0 lib/frise/loader/lazy.rb
frise-0.3.0.pre lib/frise/loader/lazy.rb