Sha256: dd00c86b3ed77a89044ba40d7f090b40dd6e01dfd28e3821354a44b10eb4b5d6

Contents?: true

Size: 775 Bytes

Versions: 6

Compression:

Stored size: 775 Bytes

Contents

require 'protocol'

# Protocol version of the Comparable module, that actually checks, if #<=>
# was implemented by the including (conforming) class.
Comparing = Protocol do
  # Compares _self_ with _other_ and returns -1, 0, or +1 depending on whether
  # _self_ is less than, equal to, or greater than _other_.
  def <=>(other) end

  include Comparable
end

# Protocol version of the Enumerable module, that actually checks, if #each
# was implemented by the including (conforming) class.
Enumerating = Protocol do
  # Iterate over each element of this Enumerating class and pass it to the
  # _block_. Because protocol cannot determine if a block is expected from a
  # C-function, I left it out of the specification for now.
  understand :each

  include Enumerable
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
protocol-1.0.1 lib/protocol/core.rb
protocol-1.0.0 lib/protocol/core.rb
protocol-0.9.0 lib/protocol/core.rb
protocol-0.8.2 lib/protocol/core.rb
protocol-0.8.0 lib/protocol/core.rb
protocol-0.8.1 lib/protocol/core.rb