Displaying 20 results from an estimated 1300 matches similar to: "Dealing with nested/namespaced classes w/ describe"
2007 Nov 23
12
namespaced controllers
Out of curiosity, I''ve seen the following fail:
module Admin
describe MyController
...
end
end
But this works fine:
describe Admin::MyController
..
end
Why?
Scott
2006 Jan 09
1
Question about image storage and relative paths
I''m writing a website with a feature that hosts images that people upload.
Right now, relative paths works within on my Windows box. So
specifically, I''m able to call File.open on
"public/images/somefile.jpg" and Rails/WEBrick understands that the
path is relative to the home directory of the project. This means that
"public/images/somefile.jpg" ends up
2006 Mar 04
2
convert string to AR class
Hi everyone,
I''m trying to convert a string passed on the command-line into an
ActiveRecord class, so I can do something like this.
a="SomeClass"
a.find(:all)
where
class SomeClass < ActiveRecord::Base
end
This appears to work (better ways would be appreciated):
a="SomeClass"
b=eval a
b.find(:all)
However I would like to make sure
2014 Feb 11
2
$new cannot be accessed when running from Rscript and methods package is not loaded
Hi
Accesses the $new method for a class defined in a package fails if the
methods package is not loaded. I have created a test package with the
following single code file:
newTest <- function() {
cl <- get("someClass")
cl$new
}
someClass <- setRefClass("someClass")
(This is similar to code actually used in the testthat package.)
If methods is not loaded,
2007 Jul 25
2
initalizing and checking validity of S4 classes
Dear useRs and wizaRds,
I am currently developing a set of functions using S4 classes. On the way I encountered the problem exemplified with the code below. For some reason the 'validity' method does not seem to work, i.e. does not check for errors in the specification of the slots of the defined class. Any hints?
My understanding of the whole S4 system was that validity checks are made
2006 Sep 27
1
acts_as_taggable with single-table inheritance?
Does anyone have any experience making this work? I installed the
plugin and tried the following:
class SomeClass < ActiveRecord::Base
acts_as_Taggable
end
class SubClass1 < SomeClass
end
class SubClass2 < SomeClass
end
SubClass1.tag_with("tag")
and notice that taggable_type = SomeClass
when I do SubClass2.find_tagged_with("tag") a SubClass1 object is
2005 Aug 10
1
using modules with models?
I''m trying to figure out how to use modules with my model classes.
I''m going to have good number of model classes that don''t map to the
database, and I''d like to put some of these in seperate modules. I''ve
been wrestling with this for 2 days and can''t figure out how to get it
to work. Rails seems to handle it fine for controllers, though.
I
2010 Apr 21
1
VERY basic question about S4 classes
Hi,
I'm new to R and S4 classes. I defined a class with two methods (myMethod1 and myMethod2). I want to call myMethod1 within myMethod2. Why does the code below not work? The name 'myMethod1' doesn't appear to have meaning inside myMethod2, even though the two methods belong to the same class.
setClass(Class="SomeClass",
representation=representation(
2013 Apr 16
7
puppet-cleaner: makes puppet DSL code comply with a subset of the style guide
FWIW,
I''ve wrote puppet-cleaner to help me make comply thousands of lines of
puppet 2.6 DSL code to puppet 2.7 style guide and expectations. I''m
uploading it to github today for anyone to use.
https://github.com/santana/puppet-cleaner
Externally, you run puppet-clean file.pp and it can transform this:
/*
multiline comment
trailing white space here ->
*/
class
2010 Apr 25
1
method dispatching vs inheritance/polymorphism (re-post)
Hi,
I'm having trouble seeing the added value over functions defined by setGeneric vis-a-vis
methods defined by inheritance and polymorphism. setGeneric offers a 'clean' call to a generic function, ie. no need to call new(), so less typing to do for the user. But such explicit calls can also be avoided by functions like f <- function(x, y) new(Class = SomeClass, x=x, y=y). Then
2015 Jul 20
3
[LLVMdev] [RFC] Developer Policy for LLVM C API
> On Jul 18, 2015, at 11:27 AM, Hal Finkel <hfinkel at anl.gov> wrote:
>
> 2. We don't have a good set of tests for it, nor do we have a good set of tutorials/documentation for it. Our tutorials, specifically, are in C++, not in C. We could break the C API and we'd likely remain unaware for quite awhile.
I think this is the most important point, that we lack testing for it.
2008 Mar 17
8
should have_tag outside Rails
Hi
Google has not helped me here. I''m looking for a way to use the have_tag
assert_select wrapper outside RSpec on Rails (but in a Rails project) so I
can use it to check text strings.
Has anyone managed this?
Thanks
Ashley
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 May 09
2
name and class href attribute in a link_to_remote
I have a link to remote and I''m trying to get the name="" and the
class="" attribute in the href so the link will come out like this:
<a href="action" onclick"ajax(action)" name="Title Of Link"
class="someclass">
So far the link looks like this:
<% for course in @courses %>
<%= link_to_remote
2006 Nov 22
2
.class call to the mock object (or any existing methods)
Hi
I run into problem trying to set expectations for the mockobject.class
method, I had to undefine a method before I could set some expectation. Is
there any better way of doing it?
object = mock()
....
klass = class <<object; self; end
klass.send(:undef_method, "class") # I had to do this because Mocha
utilizes "method_missing(symbol, *arguments, &block) "
2009 Nov 02
1
two small wishes (with code sugegstions) for R-core
Dear R developers,
It would be great if you could implement the two minor code changes suggested below, which would help processing large objects in R.
Jens Oehlschl?gel
# Wish no. 1: let [.AsIs return the class AFTER subsetting, not the class of the original object
# Wish no. 2: adjust write.csv and write.csv2 for multiple calls in chunked writing
# Rationale no. 1: a couple of packages
2007 Sep 18
2
Making attachment_fu polymorphic
I am working on a small model mixin called attachment_kung to make
attachment_fu polymorphic, so you no longer need a different table and
Model class for every associated attachment (Productimage, Ad_doc,
etc). All you really need is one model and table to handel all your
attachments - in some cases, anyway. I have the code working, but have
run into one small hitch that I can''t seem to
2007 May 23
4
content_for
Any ideas how I would go about writing specs for views which make use
of content_for?
I''d like, for example, to be able to specify that ABC view places XYZ
in the sidebar, which I do using content_for(:sidebar).
Am I missing something obvious?
Kyle
2019 Nov 11
2
class(<matrix>) |--> c("matrix", "arrary") [was "head.matrix ..."]
>>>>> Duncan Murdoch
>>>>> on Sun, 10 Nov 2019 11:48:26 -0500 writes:
> On 10/11/2019 9:17 a.m., Bryan Hanson wrote:
>>
>>
>>> On Nov 10, 2019, at 3:36 AM, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>>>
>>>>>>>> Gabriel Becker
2010 Jul 21
1
fix()ing an S4 method
Hi R experts,
The fix() function canbe used to edit normal functions. I would like to know whether it's also possible to use something similar to edit a method of an S4 class. In other words, is there a fix-like function that allows me to edit method definitions without having to go back to the source code?
setGeneric (name="doStuff",def =
2011 Sep 06
1
list of all methods winthin an S4 class
Hello,
How can I generate an overview/vector of all the methods winthin an S4 class? Similar to dir() in this Python code:
>>> class SomeClass():
def some_method_1(self):
pass
def some_method_2(self):
pass
>>> dir(SomeClass)
['__doc__', '__module__', 'some_method_1', 'some_method_2']
>>>
Thanks in advance!
Cheers!!
Albert-Jan