class SelfishAssociations::Nilifier

Public Class Methods

new(object) click to toggle source
# File lib/selfish_associations/utils/nilifier.rb, line 3
def initialize(object)
  @object = object
end

Public Instance Methods

inspect() click to toggle source
# File lib/selfish_associations/utils/nilifier.rb, line 7
def inspect
  @object.inspect + " (nil-safe)"
end
method_missing(method, *args) click to toggle source
# File lib/selfish_associations/utils/nilifier.rb, line 19
def method_missing(method, *args)
  result = @object.respond_to?(method) ? @object.public_send(method, *args) : nil
  ::SelfishAssociations::Nilifier.new(result)
end
respond_to?(method) click to toggle source
# File lib/selfish_associations/utils/nilifier.rb, line 15
def respond_to?(method)
  true
end
unnilify() click to toggle source
# File lib/selfish_associations/utils/nilifier.rb, line 11
def unnilify
  @object
end