Sha256: 7747741095bf36b968f454c5a74d508d57d874146015bc3d238af73ba65231ed
Contents?: true
Size: 1002 Bytes
Versions: 6
Compression:
Stored size: 1002 Bytes
Contents
require_relative "./collection_filter" class ReeDto::DtoCollection include Enumerable extend Forwardable def_delegators *([:@list] + Array.public_instance_methods - Object.public_instance_methods) LoadError = Class.new(ArgumentError) attr_reader :name, :contract, :parent_class contract Symbol, Any, Any => Any def initialize(name, contract, parent_class) @parent_class = parent_class @contract = contract @name = name @list = [] end contract Optblock => Any def each(&block) @list.each(&block) end contract None => String def to_s inspect end contract None => String def inspect @list.inspect end contract Any => Bool def ==(other) if other.is_a?(self.class) @list == other.instance_variable_get(:@list) else @list == other end end class << self def filter(name, filter_proc) define_method name do ReeDto::CollectionFilter.new(self, name, filter_proc) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems