class Burgundy::Collection

Public Class Methods

new(items, wrapping_class = nil, *args, **kwargs) click to toggle source
# File lib/burgundy/collection.rb, line 5
def initialize(items, wrapping_class = nil, *args, **kwargs)
  @items = items
  @wrapping_class = wrapping_class
  @args = args
  @kwargs = kwargs
end

Public Instance Methods

method_missing(name, *, &) click to toggle source
# File lib/burgundy/collection.rb, line 12
def method_missing(name, *, &) # rubocop:disable Style/MissingRespondToMissing
  to_ary.send(name, *, &)
end
respond_to?(name, include_all = false) click to toggle source
# File lib/burgundy/collection.rb, line 16
def respond_to?(name, include_all = false) # rubocop:disable Style/OptionalBooleanParameter
  to_ary.respond_to?(name, include_all)
end
to_a()
Alias for: to_ary
to_ary() click to toggle source
# File lib/burgundy/collection.rb, line 20
def to_ary
  @to_ary ||=
    if @wrapping_class
      @items.map {|item| @wrapping_class.new(item, *@args, **@kwargs) }
    else
      @items.to_a
    end
end
Also aliased as: to_a