search for: mymethod

Displaying 20 results from an estimated 23 matches for "mymethod".

2007 Mar 30
2
Replacing slot of S4 class in method of S4 class?
Dear all, Assume that I have an S4 class "MyClass" with a slot "myname", which is initialized to: myname="" in method("initialize"): myclass <- new("MyClass", myname="") Assume that class "MyClass" has a method "mymethod": "mymethod.MyClass" <- function(object, myname=character(0), ...) { object at myname <- myname; #or: myName(object) <- myname } setMethod("mymethod", "MyClass", mymethod.MyClass); Furthermore, I have a replacement method: setRep...
2002 Nov 05
1
function showMethods and inheritance
...ing question might come from my (deep) misunderstanding of the concepts in the package 'methods'. I have a class 'A', and a class 'B' inheriting 'A' (so defined with 'setClass' and the parameter 'contains="A"'. The class A has a method 'mymethod'. A call to 'showMethods("mymethod")' return the signature of the function with A, but not with B no matter whether I specify 'inherited=TRUE' or not... Any pointer ? Thanks in advance, Laurent -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-...
2011 Apr 05
1
super basic questions about S4 classes
Apologies for asking something that is probably super obvious, i just started with S4 classes and i guess i am not finding documentation that layout the grammar rules and give enough examples. Some questions i am having are these 1. I understand that main method of writing a member function is to write a generic function and setMethod for this particular object. This, however, presumes that there
2012 Aug 03
1
Interaction between callNextMethod() and selectMethod()
...text in order to know what to do but it seems that the MethodDefinition object returned by selectMethod() carries that context i.e. it seems to contain all the information that callNextMethod() would need (name of the generic and defined signature) to actually work: > mymethod <- selectMethod("as.matrix", "A") > class(mymethod) [1] "MethodDefinition" attr(,"package") [1] "methods" > mymethod at generic [1] "as.matrix" attr(,"package") [1]...
2016 Nov 24
3
llvm optimizer turning musttail into tail
I've got some calls like: musttail call void bitcast (i32 (i32, i8*, %Type*)* @MyMethod to void (i32, i8*)*)(i32 %0, i8* %1) ret void Into something like: %8 = tail call i32 @MyMethod(i32 %0, i8* %1, %Type* null) ret void I realize I'm losing a parameter there, but this is an interface jump trick I use and relies on the end code being a 'jmp' (x86). I realize i can pr...
2017 Sep 22
2
S4 method implementation for S3 class
Hi all, I'm trying to implement the matrix multiplication operator, which is S4 generic, for an old-style S3 class. The following works as expected: x <- 1:10 class(x) <- "myClass" setOldClass("myClass") setGeneric("myMethod", function(x, y) standardGeneric("myMethod")) setMethod("myMethod", c("myClass", "myClass"), function(x, y) message("dispatched!")) myMethod(x, x) #> dispatched! but I don't understand why the following won't: setMethod("%*%&...
2010 Dec 22
1
forcing evaluation of a char string argument
I'm trying to make a function to turn a regular function into an S3 generic one. I want myMethod to be: function(x,...) UseMethod("myMethod") But I keep getting: function(x,...) UseMethod(func) Here's the function: toGeneric<-function(func) { env<-environment(get(func)) # default method of new generic = the original function assign(paste(func,".default&qu...
2007 Mar 16
1
sort_link_helper and cross-controller partials
...table through an AJAX request. The setup is a follows: The table is a shared partial of Controller1 and Controller2 accessible via "shared/table". The AJAX''ed sorting using the sort helper works all fine on Controller1. An AJAX link in the table refers to a method named "mymethod" on Controller2. Controller2 does what is expected from it and does a render :partial => "shared/table" and the table is correctly displayed. However, the links generated by sort_link_helper change to the format of "/controller2/mymethod?aknownname=111802211&amp;sort=my_...
2006 Aug 10
1
Passing parameters defined in a function or something
Hi, I have method I want to call ... it can receive * number of parameters. I also have 3 parms that I want to pass often, so I have defined them in a separate function: def my_params { :parm1 => 1, :parm2 => 2, :parm3 => 3 } end And I want to call my method like this: mymethod :parm4 => 4, my_params Now - this doesn''t work - as my_params is a hash of params, which isn''t the same as calling mymethod :parm4, :parm1 => 1, :parm2 => 2, :parm3 => 3 Pretty basic - yet fundamental. How do I solve this? Thanks Joerg -- Posted via http://www....
2016 Nov 27
3
llvm optimizer turning musttail into tail
...buggy to me. What pass is doing this? > > -- Sean Silva > > On Thu, Nov 24, 2016 at 5:39 AM, Carlo Kok via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> >> I've got some calls like: >> >> musttail call void bitcast (i32 (i32, i8*, %Type*)* @MyMethod to void >> (i32, i8*)*)(i32 %0, i8* %1) >> ret void >> >> Into something like: >> %8 = tail call i32 @MyMethod(i32 %0, i8* %1, %Type* null) >> ret void >> >> I realize I'm losing a parameter there, but this is an interface jump >> trick I us...
2017 Sep 22
0
S4 method implementation for S3 class
...i all, > > I'm trying to implement the matrix multiplication operator, which is > S4 generic, for an old-style S3 class. The following works as > expected: > > x <- 1:10 > class(x) <- "myClass" > > setOldClass("myClass") > setGeneric("myMethod", function(x, y) standardGeneric("myMethod")) > setMethod("myMethod", c("myClass", "myClass"), function(x, y) > message("dispatched!")) > > myMethod(x, x) > #> dispatched! > > but I don't understand why the following...
2005 Dec 29
2
Access rails logger from plain class
How can I "get" the rails logger from a plain class, that is a class that does not inherit from a rails class? I have tried using RAILS_DEFAULT_LOGGER (see below) but it''s nil class MyClass logger = RAILS_DEFAULT_LOGGER def myMethod logger.debug("stuff...") end end -- Posted via http://www.ruby-forum.com/.
2007 Dec 20
3
What is $super
Greetings, I had a question about the $super argument that I wasn''t able to find in documentation, searching etc. What exactly is the $super argument. Is it a reference to the super class''s prototype function? Or is it an instantiated object of the super class that is passed to the subclass''s method? I am completely confuzzled on this one, my typical
2004 Mar 30
12
Big question: Move to SWIG?
A few days ago, someone asked me why I am using wxpp instead of SWIG. The question prompted me to revisit and re-evaluate SWIG, and I now believe it would be best to convert wxRuby to SWIG. SWIG has greatly improved its C++ support since the last time I looked at it, and I think its Ruby support has improved quite a bit as well. Also, now that I have written wxpp, I understand the nature of
2009 May 06
1
How to extend ActionMailer
I wish to extend ActionMailer::Base by method chaining a class instance variable: module ActionMailer class Base class << self def method_name ... What is the magic incantation to accomplish this? I cannot get this to work with action mailer: module MyMethods def self.include(base) base.alias_method_chain :method_name, :my_method def method_name_with_my_method ... stuff method_name_without_my_method end ... end class ActionMailer::Base include MyMethods end require ''my_methods'' -- Posted via http://www.ruby-...
2009 Sep 07
1
some (minor) Rd issue: line breaking in \S4method within \usage{}
...h), one would probably like to be able to insert line breaks within the signature list [or at least insert line breaks at suitable places in the corresponding generated pdf file]. AFAICS this is not possible so far, at least I get errors in R CMD check, whenever I try something like \S4method{<myMethod>}{<ClassOf1stArgToDispatch>, <ClassOf2ndArgToDispatch>}(<Name1stArgToDispatch>,<Name2ndArgToDispatch>) i.e. if I insert a line break in the Rd file after any item of the signature_list argument to \S4method. Using line breaks in the the third (argument_list) argument is...
2009 Nov 23
1
OOP with Encapsulated Class Definitions
...ons, however there are other possibilities... Priority has been given to space rather than speed, hence the unorthodox method despatch, however again, there are other possibilities... Here is an example of inheritance: > MySuperClass = function (...) { MySuperClass = function (x) .$x = x mymethod = function () cat (.$x, "\n") mclass () } > MySubClass = function (...) { MySubClass = function (y) super (y) mclass (super="MySuperClass") } > myobj = MySubClass (10) > myobj~mymethod () 10 kind regards Charlotte Maia (first time poster)
2009 Feb 01
8
undefined method `inherit'' for Merb::Test::ExampleGroup
RSpeckers: I''m trying to install this into a Merb-generated RSpec rig: http://code.jeremyevans.net/doc/fixture_dependencies/ It requires inserting their test case into RSpec. This is the documented way to do it: describe ''Post'' do inherit FixtureDependencies::SequelTestCase And that leads to the syntax error in the subject line. (No stack trace is available
2011 Jun 01
1
Overloading S4 methods
...been loaded, but a call to plot(anobjectofmyS4class) comes up with the result of running the first method, from pkg A. I have tried importing 'plot' in B's NAMESPACE from both graphics or A, but the end result is the same. Package B does the same thing for a method created by pkg A, myMethod, and that works fine. Any pointers or where this might be going wrong? How is it that a different method than the one shown by selectMethod() is being run? Something to do with the 'missing' part of the signature? Many thanks, Iago Mosqueira
2003 May 19
3
how to run R as a daemon
Hi all, Using R a as a real-time application called by Php for a website, I would like to run one R process only, which would manage user connections. For the time each user who asks for an analysis causes a new R process to start, which is not suitable in prevision of many users. R needs about 30 seconds to run the script which makes the analysis. The problem is that this waiting time is n