lupo

Gem Version Build Status Dependency Status Code Climate Coverage Status

Usage

require 'lupo'

class TaskList
  include Lupo.enumerable(:tasks)

  def initialize(name, tasks)
    @name, @tasks = name, tasks
  end
end

list = TaskList.new('secret', %w[this and that])

list.each { |t| puts(t) }     # => list
list.each.to_a                # => ['this', 'and', 'that']
list.is_a?(Enumerable)        # => true
list.methods.include?(:tasks) # => false

class ItemList
  include Lupo.collection(:items)
end

list = ItemList.new(%w[this and that])

list.each { |i| puts(i) }               # => list
list.each.to_a                          # => ['this', 'and', 'that']
list.is_a?(Enumerable)                  # => true
list.protected_methods.include?(:items) # => true

other = ItemList.new(%w[this and that])

# see equalizer for detailed docs
list.equal?(other) # => false
list.eql?(other)   # => true
list == other      # => true

Credits

Contributing

See CONTRIBUTING.md for details.

Copyright © 2013 Martin Gamsjaeger (snusnu). See LICENSE for details.