search for: newargs

Displaying 5 results from an estimated 5 matches for "newargs".

2006 Mar 07
3
Expanding partial names
...ts for the low level functions because there are about a dozen wrapper functions, and about 20 arguments to lowlevel. Instead I'm trying something like this: lowlevel <- function(longname = 1) { cat("longname = ", longname, "\n") } wrapper <- function(...) { newargs <- list(longname = 2) newargs[names(list(...))] <- list(...) do.call("lowlevel", newargs) } This almost works: > wrapper() longname = 2 > wrapper(longname = 3) longname = 3 But it fails if I try to use partial argument matching: > wrapper(long=4) Error in low...
2007 Feb 06
3
Using any_instance with Rails to make sure the right thing is saved?
I''d like to test that an object with the correct attributes is saved, something like: def test_create_without_existing_suite this = self w = Annotation.any_instance.expects(:save).with do |x| this.assert_equal ''fnord'', some_way_get_the_name_of_the_receiver_of_save true end w.returns true end But the object is created inside the method
2013 Sep 04
4
Comments requested on "changedFiles" function
...o, FALSE)) file.info <- NULL if (missing(md5sum)) md5sum <- snapshot$md5sum if (missing(full.names)) full.names <- snapshot$full.names pre <- snapshot$pre savewd <- getwd() on.exit(setwd(savewd)) setwd(snapshot$wd) args <- snapshot$args newargs <- list(...) args[names(newargs)] <- newargs post <- dosnapshot(args)$info prenames <- rownames(pre) postnames <- rownames(post) added <- setdiff(postnames, prenames) deleted <- setdiff(prenames, postnames) common <- intersect(prenames, po...
2006 Aug 07
4
Memory leak?
I am using BackgrounDRb to resize images after they are accepted into our system. However, it has become clear that this creates a memory leak. I''m not sure exactly where the leak exists, but I don''t think it''s in my own code as it is presently being used in production and has resized thousands of images without a leak occurring, thanks to calling GC.start
2004 Dec 07
30
Bind Variables in Active Record
OK, I have some basic functionality to support bind variables, it appears to work with the ''old'' %s style too. I''ve altered sanitize_conditions in activerecord/lib/active_record/base.rb to check whether bind variables are in the statement (/\?/). If they are, replace all the ?s to escaped values from the arguments array. else santize and expand. There are a few