Sha256: c1fa61020a95d2645fd824f60843d8ee086077e8da7cdcd5d80bd4fbac8c6fc9
Contents?: true
Size: 896 Bytes
Versions: 16
Compression:
Stored size: 896 Bytes
Contents
# frozen_string_literal: true # Based on https://github.com/HornsAndHooves/lazy_object module Grape module Util class LazyObject < BasicObject attr_reader :callable def initialize(&callable) @callable = callable end def __target_object__ @__target_object__ ||= callable.call end def ==(other) __target_object__ == other end def !=(other) __target_object__ != other end def ! !__target_object__ end def method_missing(method_name, *args, &block) if __target_object__.respond_to?(method_name) __target_object__.send(method_name, *args, &block) else super end end def respond_to_missing?(method_name, include_priv = false) __target_object__.respond_to?(method_name, include_priv) end end end end
Version data entries
16 entries across 16 versions & 2 rubygems