Chain

Expiremental library for safe method chaining.

  person = "John Doe"
  def person.address = "123 West St."
  person.address.street #=> Error

To avoid the error use chain:

  person.chain.address.street.end   #=> nil

Or

  ~ person.chain.address.street     #=> nil
Methods
Public Class methods
new(value)
# File lib/more/facets/chain.rb, line 21
  def initialize(value)
    @value = value
  end
Public Instance methods
end()

def value?

  @value

end

# File lib/more/facets/chain.rb, line 43
  def end
    @missing ? nil : @value
  end
method_missing(s,*a, &b)
# File lib/more/facets/chain.rb, line 25
  def method_missing(s,*a, &b)
    if @value.respond_to?(s)
      @value = @value.__send__(s,*a,&b)
    else
      @missing = true
    end
    #begin
    #  @value = @value.__send__(s,*a,&b)
    #rescue NoMethodError
    #  @missing = true
    #end
    self
  end
~()
# File lib/more/facets/chain.rb, line 47
  def ~@
    @missing ? nil : @value
  end