Sha256: c7ea744c6f10968be575d82137ecac69f1460eadd43fbefb5aa5faf852282bd9
Contents?: true
Size: 972 Bytes
Versions: 6
Compression:
Stored size: 972 Bytes
Contents
# frozen_string_literal: true # Based on https://github.com/HornsAndHooves/lazy_object module Grape module Util module Lazy class Object < 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 end
Version data entries
6 entries across 6 versions & 1 rubygems