@param [ WpItems ] other
@return [ self ]
# File lib/common/collections/wp_items.rb, line 63 def +(other) other.each { |item| self << item } self end
@param [String,] argv
@return [ void ]
# File lib/common/collections/wp_items.rb, line 19 def add(*args) index = 0 until args[index].nil? arg = args[index] if arg.is_a?(String) if (next_arg = args[index + 1]).is_a?(Hash) item = create_item(arg, next_arg) index += 1 else item = create_item(arg) end elsif arg.is_a?(Item) item = arg else raise 'Invalid arguments' end self << item index += 1 end end
@param [ String ] name @param [ Hash ] attrs
@return [ WpItem ]
# File lib/common/collections/wp_items.rb, line 47 def create_item(name, attrs = {}) raise 'wp_target must be set' unless wp_target item_class.new( wp_target.uri, attrs.merge( name: name, wp_content_dir: wp_target.wp_content_dir, wp_plugins_dir: wp_target.wp_plugins_dir ) { |key, oldval, newval| oldval } ) end
Generated with the Darkfish Rdoc Generator 2.