search for: singleton_methods

Displaying 9 results from an estimated 9 matches for "singleton_methods".

2007 Mar 06
15
mocking missing methods
Hi folks. So I''m using mocha on a ruby project, and I really like it. One thing I''ve noticed is that it can be a bit "surprising" when I''m mocking methods that don''t exist on an object, and I think there''s an easyish fix. At the moment, you use sheep = mock() to create a mock sheep. What I''d like to do is something like sheep =
2008 Dec 05
3
"singleton can't be dumped," but not using singleton
An action handler (select_person_by_name) in my controller class assigns into session, and then does a redirect_to. I get the error "TypeError (singleton can''t be dumped):" followed by a stack trace that doesn''t cross my code. Google tells me this is ordinarily caused by assigning a singleton instance into session, but what I''m assigning is an ordinary String.
2006 Mar 12
2
Find all the methods on a object in an irb session?
How can I find all the methods on an object from withing irb? Thanks, Joe
2012 Sep 22
4
Class, Module, Object
>> reload! Reloading... => true >> puts Class < Module true => nil >> puts Module < Class false => nil >> puts Module < Object true => nil >> puts Object < Module false => nil >> Object.parent => Object The above indicates that the Class object instance inherits from the Module object instance and the Module object instance
2006 Jul 05
2
Serialized object behaves weird
Hi! I got a class named EinsatzFilter which I serialized to session. Before saving to session it works afterwards I keep getting the message: "undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from ActiveRecord::Base inherited class. Code: class EinsatzFilter include ApplicationHelper attr_reader :personen, :monat, :projekte, :kunde
2006 Jun 30
6
RSS::Parser Documentation
Hi I am trying to use the RSS classes from "rss/2.0" and everything works but I want to know what attributes and properties I can get at from each of the classes I am getting back. For example, the class has a "channel" which I can tell has a "title" attribute (because it works when I query it :) but I would really like a list of every attribute that is
2005 Dec 27
3
myObject.send(column.name) from Agile Development book
I''m studying the Agile Development with Rails book. In the chapter that first sets up the depot application (page 68), there is this bit of code from a view: <% for product in @products %> <tr> <% for column in Product.content_columns %> <td><%=h product.send(column.name) %></td> <% end %> etc... I am trying to absorb both Ruby and
2005 Mar 09
21
Converting time retrieved from MySQL
I''m having a problem converting a date retrieved from my MySQL database and I''m hoping someone can help. MySQL stores the date/time as this: 2005-03-08 17:00:34.0 and according to my Pickaxe book Ruby stores times as "the number of seconds and microseconds since [...] January 1, 1970". All well and good. Unfortunately, RoR is converting my date to this:
2008 May 13
6
Testing that named_scope is defined
Hi guys, I''m just beginning to use RSpec and I ran into the issue of testing a named_scope. I''m not actually trying to test its behavior, as it''s not my code, but I wanted to test at least that it''s defined. I tried doing this: describe Post, ".most_recent" do it "should be defined" do Post.method_defined?(:most_recent).should be_true