search for: klass

Displaying 20 results from an estimated 409 matches for "klass".

Did you mean: class
2007 May 29
0
[1035] trunk/wxruby2/swig/classes/EvtHandler.i: Removed a heap of redundant stuff that''s been #if 0''d for a while
...NU_HIGHLIGHT); -} - -static VALUE evt_menu_highlight_all(int argc, VALUE *argv, VALUE self) -{ - return internal_evt_no_parameters(argc, argv, self, wxEVT_MENU_HIGHLIGHT_ALL); -} - - -// TODO: Add for ListEvent types? Is this needed? - -%} - - - - -%init %{ - rb_define_method(cWxEvtHandler.klass, "connect", VALUEFUNC(connect_fnc), -1); - rb_define_method(cWxEvtHandler.klass, "evt_menu", VALUEFUNC(evt_menu), -1); - rb_define_method(cWxEvtHandler.klass, "evt_tool", VALUEFUNC(evt_menu), -1); - rb_define_method(cWxEvtHandler.klass, "evt_menu_range&qu...
2003 Aug 24
2
wxRuby 0.1.0 Alpha has been released!
http://rubyforge.org/project/showfiles.php?group_id=35&release_id=46 The code itself has been quite stable for several weeks. This release includes Gour''s excellent MinGW README notes, along with various updates to the README, and clarification of the LICENSE. Thanks to everyone for your help in putting this together. It was definitely a team project. I look forward to getting lots
2009 Nov 26
4
Is this a bug?
Hello all, while I''m using acts_as_audited(on jruby platform), after vendored the acts_as_audited, it reports some error, line 167, # Start observing the declared classes and their subclasses. def initialize Set.new(observed_classes + observed_subclasses).each { |klass| add_observer! klass } #this line end after some trace shows this one, when observed_classes is empty, will return 0(Fixnum) causes the above line to report error, def observed_subclasses observed_classes.sum([]) { |klass| klass.send(:subclasses) } end so I changed it to this: def obse...
2005 Dec 15
1
Ruby Hash wierdness
Hi I''m having problems with using a hash. I put in a class and when I retrieve it, it''s automagically become a string ie <%= button_link _("Export CSV"), SearchParams.get_url_hash({ :action => :export_csv, :klass => Customer }, params, @search_fields) %> Customer is a class that is available to my view def export_csv klass = params[:klass] cond = SearchParams.get_search_conditions(klass, params, @search_fields) set_csv_headers(klass) csv_export(klass, cond) end but here klass (a...
2007 Mar 30
7
problem with using any_instance
Hey all, I have a question with using mocha in my tests. In the same test file, I have two tests, <code> def test_a klass.any_instance.stubs(:method_name).returns("something") klass.new.method_name ... end def test_b ... klass.new.method_name ... end </code> where klass is some class when the tests run, test _a passes, but test_b had an error like this: test_b NoMethodError: undefined met...
2012 Jan 24
2
[PATCH 26/28] pci: convert to QEMU Object Model
...DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features), + DEFINE_PROP_STRING("mount_tag", VirtIOPCIProxy, fsconf.tag), + DEFINE_PROP_STRING("fsdev", VirtIOPCIProxy, fsconf.fsdev_id), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_9p_class_init(ObjectClass *klass, void *data) +{ + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + k->init = virtio_9p_init_pci; + k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; + k->device_id = 0x1009; + k->revision = VIRTIO_PCI_ABI_VERSION; + k->class_id = 0x2; +} + +static DeviceInfo virtio_9p_i...
2006 Nov 12
0
[ wxruby-Bugs-6632 ] Linux crash on NoteBook in bigdemo.rb
....h:154 #3 0xb77b9916 in _wrap_wxNotebook_AddPage (argc=4, argv=0xbf81a2b0, self=3043848000) at src/Notebook.cpp:3472 #4 0x08055146 in call_cfunc (func=0xb77b9800 <_wrap_wxNotebook_AddPage>, recv=3043848000, len=0, argc=0, argv=0xbf81a2b0) at eval.c:5654 #5 0x0805d8cb in rb_call0 (klass=3063385500, recv=3043848000, id=11233, oid=11233, argc=1, argv=0xbf81a2b0, body=0xb6978d10, flags=0) at eval.c:5810 #6 0x0805e521 in rb_call (klass=3063385500, recv=3043848000, mid=11233, argc=4, argv=0xbf81a2b0, scope=1) at eval.c:6048 #7 0x0805c078 in rb_eval (self=<value optim...
2008 Jan 11
5
Missing methods
We have a custom implementation of the Mother Object idea. It''s inside of a module, basically like this: module Factory %w(account friendship person invitation message asset email_address birth).each do |klass| eval <<-EOF def self.create_#{klass}(attributes = {}) default_attributes = valid_#{klass}_attributes #{klass.camelize}.create! default_attributes.merge(attributes) end EOF end def valid_message_attributes(options = {}) { #some message options } end #more valid_x_att...
2007 Aug 07
2
stubs which yield and return
Is there any reason why a stub couldn''t both yield and return? I''m looking for a way to mock out a class I''ve made named "AnonymousClass": class AnonymousClass def initialize(&blk) @klass = Class.new @klass.instance_eval(&blk) if block_given? end def new @klass.new end def evaluate(&blk) @klass.instance_eval(&blk) end attr_reader :klass alias_method :class, :klass end One of the behaviours of the AnonymousClass is that new can take...
2007 May 31
0
[1042] trunk/wxruby2: Overhaul of the event handling WxType->RubyClass mapping to make it
...lt;/span><span class="lines">@@ -0,0 +1,225 @@ </span><ins>+# All classes which are capable of handling events inherit from +# EvtHandler. This includes all Wx::Window subclasses and Wx::App. + +class Wx::EvtHandler + + def self.event_class_for_type(id) + if evt_klass = EVENT_TYPE_MAPPING[id] + return evt_klass + else + warn "No event class defined for event type #{id}" + return Wx::Event + end + end + + # This has maps integer EventType ids from the Wx API to Ruby + # classes. It''s called internally by the C++ code to...
2019 Nov 01
3
R C api for 'inherits' S3 and S4 objects
...ead safe). This is unfortunately not possible for S4 classes. I would kindly request new function in R C api so it can be achieved for S4 classes with no risk of allocation. For reference mentioned functions below. Thank you. Jan Gorecki // S3 inheritance bool INHERITS(SEXP x, SEXP char_) { SEXP klass; if (isString(klass = getAttrib(x, R_ClassSymbol))) { for (int i=0; i<LENGTH(klass); i++) { if (STRING_ELT(klass, i) == char_) return true; } } return false; } // S4 inheritance bool Rinherits(SEXP x, SEXP char_) { SEXP vec = PROTECT(ScalarString(char_)); SEXP call = PROT...
2006 Jun 28
2
[PATCH] Bug fixes and additions to scoped_access
...ScopedAccess::Filter#before looks like this: @scoping = controller.instance_eval(@scoping.to_s) if @scoping.is_a?(Symbol) This makes @scoping not a symbol on the first run and @scoping will never be evaluated again. This would fail in code which looks like this: For example: def silo_filter(klass) filter = ScopedAccess::ClassScoping.new klass, :silo_id => @silo.id end where, @silo is set in a before_filter. I''ve also added in some code to check if the passed in scoping is a method. If it is, the method is called with the class as a parameter. This allows for more DRY c...
2006 Jan 06
0
bug rails activerecord association join
..." LEFT OUTER JOIN #{reflection.options[:join_table]} ON " + "#{reflection.options[:join_table]}.#{reflection.options[:foreign_key] || to_s.foreign_key} = " + "#{table_name}.#{primary_key} " + " LEFT OUTER JOIN #{reflection.klass.table_name} ON " + "#{reflection.options[:join_table]}.#{reflection.options[:association_foreign_key] || reflection.klass.to_s.foreign_key} = " + "#{reflection.klass.table_name}.#{reflection.klass.primary_key} " when :has_many, :has_o...
2006 Oct 05
4
search results autocompletion
...ex(create) [Person, Project, Orgunit].each{|kl| terms = self.all_terms(kl) terms.each{|term| suggestion = Suggestion.new suggestion.term = term SUGGESTION_INDEX << suggestion.to_doc } } SUGGESTION_INDEX.optimize end def self.all_terms(klass) reader = Index::IndexReader.new(Object.const_get(klass.name.upcase + "_INDEX_DIR")) terms = [] begin reader.field_names.each {|field_name| term_enum = reader.terms(field_name) begin term = term_enum.term() if !term.nil? if klass::SUG...
2006 Jun 13
3
Dynamic determination of class under test...
...n rather than rails, but I can''t seem to locate the answer -- given a string containing a class name is there a way to a) check if that class is defined/locatable for inclusion b) convert the string to a Class object for the named class Ie, I''m trying to do: def setup @klass=class_under_test(self.class) end protected def class_under_test(klass) /([A-Z][a-z_]*)Test/.match(klass.to_s) $1 # <----- Now I have a string, not a Class, obviously # Of course I need a more complete alogrithm here, but I''d like to # to get the base case...
2006 Jul 25
6
Wizards
Hi Please find attached a set of patches and swig files to implement Wizards for wxruby. Also a brief sample. Quick q - the C declarations of evt_xxx_xxx methods and their attaching to Ruby classes seems to be duplicated across Events.i and EvtHandler.i - is one of these the right place to be adding them? or both? Thanks alex _______________________________________________
2010 Dec 23
6
Difference between rake test:units and individually running ruby -I test test/unit/something_test.rb ?
...rfectly. However, running rake test:units brings errors in all of them - some object becomes nil for some reason. Why might this be happening? Specifics: the object that is successfully not nil when I run the unit tests one-by-one but becomes nil when I do rake test:units is defined like this... klass = self.name.gsub(/Test$/, "").constantize instance = klass.first ...and I''m sure that my test db is populated whenever I run my tests... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, s...
2019 Nov 01
4
[External] R C api for 'inherits' S3 and S4 objects
...d kindly request new function in R > > C api so it can be achieved for S4 classes with no risk of allocation. > > For reference mentioned functions below. Thank you. > > Jan Gorecki > > > > // S3 inheritance > > bool INHERITS(SEXP x, SEXP char_) { > > SEXP klass; > > if (isString(klass = getAttrib(x, R_ClassSymbol))) { > > for (int i=0; i<LENGTH(klass); i++) { > > if (STRING_ELT(klass, i) == char_) return true; > > } > > } > > return false; > > } > > // S4 inheritance > > bool Rinherits...
2006 Oct 22
3
Keeping DRY - I like a simple life!
Hi, I''m new to Ruby and Rails and I would be very grateful for some advice. I''ve got the following code. class Foo < ActiveRecord::Base include Versionable # Some methods to handle my versioned objects has_many :versions, :class_name => "FooVersion", :foreign_key => "parent_id" belongs_to :curr, :class_name => "FooVersion",
2007 Jul 13
0
4 commits - configure.ac libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_object.h libswfdec/swfdec_scriptable.c libswfdec/swfdec_scriptable.h NEWS
...) -{ - SwfdecScriptable *script = SWFDEC_SCRIPTABLE (object); - - g_assert (script->jsobj == NULL); - - G_OBJECT_CLASS (swfdec_scriptable_parent_class)->dispose (object); -} - -static JSObject * -swfdec_scriptable_create_js_object (SwfdecScriptable *scriptable) -{ - SwfdecScriptableClass *klass; - JSContext *cx; - JSObject *obj; - - klass = SWFDEC_SCRIPTABLE_GET_CLASS (scriptable); - g_return_val_if_fail (klass->jsclass != NULL, NULL); - cx = scriptable->jscx; - - obj = JS_NewObject (cx, (JSClass *) klass->jsclass, NULL, NULL); - if (obj == NULL) { - SWFDEC_ERROR (&quot...