Skip to content

#predicates_return(false) breaks NullObject coercion #60

Open
@nilcolor

Description

# without config.predicates_return false
NullObject = Naught.build do |config|
  def coerce(other)
    [0, other]
  end
end

null = NullObject.new;
1 / null # => 0

# with config.predicates_return false
NullObject = Naught.build do |config|
  config.predicates_return false

  def coerce(other)
    [0, other]
  end
end

null = NullObject.new;
1 / null # => NullObject can't be coerced into Fixnum

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

      Participants

      @nilcolor

      Issue actions

        `#predicates_return(false)` breaks NullObject coercion · Issue #60 · avdi/naught