Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Nov 24, 2014
  1. @jferris

    Enumerable methods return Present, Blank

    jferris authored
    Returns Present or Blank where useful:
    * collect (same behavior as fmap)
    * each (same behavior as present)
    * find_all (convert to Blank if the block doesn't match)
    * grep (convert to Blank if the pattern doesn't match)
    * map (same behavior as fmap)
    * reject (convert to Blank if the block matches)
    * select (convert to Blank if the block doesn't match)
    Allows chaining Enumerable methods to get a wrapped value as well as
    combining Enumerable methods with wrapped methods like `fmap`.
    Producing an Array for these methods is not useful, because it's
    unlikely that you'll want zero or more items (Array) in situations where
    you started with either zero or one (Blank/Present).
Commits on Nov 13, 2014
  1. @jferris

    Change unwrap_or to take a block default

    jferris authored
    * You can already modify the wrapped value using `fmap`
    * It's convenient to have blocks for lazy defaults
    * Useful for raising a specific exception for blanks
    * Breaks backwards compatibility
  2. @jferris

    Fix violation of functor laws

    jferris authored
    Because `nil` exists as a singleton in Ruby, we need to preserve it when
    yielded from `fmap` in order to obey the functor laws.
    This ensures that:
        1.wrapped.fmap { nil }.unwrap_or(1)
    Returns `nil` and not `1`.
Commits on Oct 30, 2014
  1. @jferris @mike-burns

    Update RSpec

    jferris authored mike-burns committed
    * Use RSpec 3.1.x
    * Use expect syntax
    * Avoid operator matchers
  2. @jferris @mike-burns

    Fix equality checks with unwrapped objects

    jferris authored mike-burns committed
    Previous behavior: unwrapped comparison would raise an exception.
    New behavior: unwrapped comparison returns false (unequal).
Commits on Oct 29, 2014
  1. @jferris @mike-burns

    Rename #try to #flat_map

    jferris authored mike-burns committed
    * #try already means something else in Ruby
    * #flat_map is a Rubyish name we can borrow from Scala
Commits on Oct 28, 2014
  1. @jferris

    Define wrapped on BasicObject

    jferris authored
    Necessary for delegators and proxies. Without this change, you get a wrapped
    instead of the delegator/proxy target instead.
Commits on Dec 14, 2011
  1. @jferris


    Joe Ferris and Mike Burns authored jferris committed
Commits on Jul 29, 2011
  1. @mike-burns
  2. @mike-burns
  3. @mike-burns
  4. @mike-burns
  5. @mike-burns
Something went wrong with that request. Please try again.