Sha256: 1863f76404ed7ab2c1c94e3fcc72fa6b54be7ddb9c0c88a1da6dec0d0215e0ac
Contents?: true
Size: 505 Bytes
Versions: 8
Compression:
Stored size: 505 Bytes
Contents
# encoding: utf-8 require 'attr_enumerable/attr_enumerable_helper' # AttrEnumerable module AttrEnumerable private def last_attr(attribute, method_name, *args, &block) col = collection return [] if col.empty? last_size = args.size == 0 ? nil : Integer(args.last) fail ArgumentError, "invalid attribute #{attribute}" unless include_attr?(col.last, attribute) attrs = col.map { |v|v.send(attribute) } last_size.nil? ? attrs.last : attrs.last(last_size) end end
Version data entries
8 entries across 8 versions & 1 rubygems