search for: metaclass

Displaying 20 results from an estimated 25 matches for "metaclass".

2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
...hods.rb (working copy) @@ -68,6 +68,7 @@ method_names = method_names.is_a?(Hash) ? method_names : { method_names => nil } method_names.each do |method_name, return_value| expectations << Stub.new(self, method_name, backtrace).returns(return_value) + self.metaclass.send :undef_method, method_name if self.metaclass.method_defined? method_name end expectations.last end Index: test/mocha/auto_verify_test.rb =================================================================== --- test/mocha/auto_verify_test.rb (revision 1114) +++ test/mo...
2007 Apr 05
3
Extending assigns in controller specs?
Hello, I am interested in enhancing assigns in controller specs to do things like the following assigns[:key1, :key2, :key3] #=> vals for keys Is there away to "break open" this construction to overload the :[] operator? Thanks. -Chris
2008 Mar 03
0
A kind of monkey patch and an invitation for criticism for all you (who know this stuff better than I do)
...oved this suggestion, which helps by not cluttering the namespace of controllers: http://snippets.dzone.com/posts/show/1799 But I wanted to generalize this a little to automatically include whatever helper modules are included in the views. So I dreamt up 35 lines of goodness: class Object def metaclass; class << self; self; end; end end module ActionController class Base class_inheritable_accessor :controller_helper_module class_inheritable_accessor :controller_helper_object self.controller_helper_module = Module.new self.controller_helper_object = Object.new class &...
2009 Apr 09
1
method_exists? is missing?
In a controller run through webrick I do this: @entity = Entity.new print @entity.methods.sort.to_yaml and I see this: - logger - mark_for_destruction - marked_for_destruction? - metaclass - method - method_missing - methods - new_record? There is no method_exists? method. If I instead do this in a console session, I see this: $ script/console >> >> @entity = Entity.new => ... >> print @entity.methods.sort.to_yaml ... - logger - mark_for_destruction - marked...
2007 Feb 15
4
defining context(s) dynamically
...p;&nbsp;&nbsp; klass = resource.classify<br> &nbsp;&nbsp;&nbsp; <br> &nbsp;&nbsp;&nbsp; setup do<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @mock = mock_model sym # based on <a class="moz-txt-link-freetext" href="http://metaclass.org/2006/12/22/making-a-mockery-of-activerecord">http://metaclass.org/2006/12/22/making-a-mockery-of-activerecord</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @model = Object.const_get(klass)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @model.shoul...
2013 Aug 30
3
rspec-puppet not working
...init_spec.rb failed* It seems like it can''t load rspec, but if I do ''gem list --local'' it shows in the list of locally installed gems: *vagrant@ubuntu-server-10044-x64-vbox4210-nocm:/modules/couchbase$ gem list --local* * * **** LOCAL GEMS **** * * *diff-lcs (1.2.4)* *metaclass (0.0.1)* *mocha (0.14.0)* *puppet-lint (0.3.2)* *puppetlabs_spec_helper (0.4.1)* *rake (10.1.0)* *rspec (2.14.1)* *rspec-core (2.14.5)* *rspec-expectations (2.14.2)* *rspec-mocks (2.14.3)* *rspec-puppet (0.1.6)* * * Does anyone know why it''s not working? I''ve searched for an answe...
2012 Jul 31
1
puppet doc questions
...d (3.0.15) activeresource (3.0.15) activesupport (3.0.15) ancestry (1.2.5) arel (2.0.10) audited (3.0.0.rc1) audited-activerecord (3.0.0.rc1) builder (2.1.2) diff-lcs (1.1.3) erubis (2.6.6) has_many_polymorphs (3.0.0.beta1) hiera (0.3.0) i18n (0.5.0) jquery-rails (1.0.19) json (1.7.3) mail (2.2.19) metaclass (0.0.1) mime-types (1.19) mocha (0.12.1) mysql (2.8.1) net-ldap (0.3.1) polyglot (0.3.3) puppetlabs_spec_helper (0.2.0) rack (1.2.5, 1.1.0) rack-mount (0.6.14) rack-test (0.5.7) rails (3.0.15) railties (3.0.15) rake (0.9.2.2) rdoc (3.12) rdoc-data (3.12) rest-client (1.6.7) rspec (2.11.0) rspec-cor...
2005 May 07
2
[LLVMdev] calling conventions and inlining
...May 2005, Markus F.X.J. Oberhumer wrote: > I see that you are objecting explicit inline control. > > The main problem is that inlining is absolutely crucial for some > "modern" programming styles. E.g. we use a huge collection of small C++ > template classes and template metaclasses, most of which have very > trivial and limited functionality (think of it as some "bytecode" > expressed in classes). Of course, these method calls of these classes > _must_ be inlined, but there are also "traditional" calls to other > functions which may or ma...
2007 Jan 11
4
counter-intuitive behaveour when passing a proc to Mocha::Expectation#returns
...lambda { eval "len" } ) Unfortunately this doesn''t work, since the "stubs" method doesn''t at all take parameter names into account. As far as I can see, this is the place where the actual method replacement is being done: def define_new_method stubbee.metaclass.class_eval "def #{method}(*args, &block) mocha.method_missing(:#{method}, *args, &block); end" end and it just passes all the arguments as an array. I''m not suggesting the fix for the problem at hand is trivial - I can''t see at a glance how one can deter...
2005 May 07
0
[LLVMdev] calling conventions and inlining
...Oberhumer wrote: > >> I see that you are objecting explicit inline control. >> >> The main problem is that inlining is absolutely crucial for some >> "modern" programming styles. E.g. we use a huge collection of small >> C++ template classes and template metaclasses, most of which have >> very trivial and limited functionality (think of it as some >> "bytecode" expressed in classes). Of course, these method calls of >> these classes _must_ be inlined, but there are also "traditional" >> calls to other functions...
2012 Aug 17
3
puppet-rspec / puppetlabs_spec_helper
I am using puppet 2.7.14 on Ubuntu 10.04 LTS. I have the following gems: *** LOCAL GEMS *** diff-lcs (1.1.3) hiera (0.3.0) hiera-puppet (0.3.0) metaclass (0.0.1) mocha (0.12.1) puppet-lint (0.1.13) puppetlabs_spec_helper (0.2.0) rake (0.9.2.2) rspec (2.11.0) rspec-core (2.11.1) rspec-expectations (2.11.2) rspec-mocks (2.11.1) rspec-puppet (0.1.3) When I run "rake help" I get the following: $ sudo rake help --trace (in /etc/puppet/environ...
2007 Jan 05
6
RSpec 0.7.5 with Rails and rcov
I seem to be missing something because I am at a loss on how to get rcov, RSpec, and Rails working together. Would someone mind dropping some hints?
2006 May 26
9
What syntax is this? belongs_to :Person
so when I''m reading the pick axe book second edition I don''t see anything like the syntax you see people using in rails code. Specifically when you see. belongs_to :Person has_many :Phones etc these are methods on ActiveRecord right? Why is this invocation syntax never described in the Pick Axe book? I do see things like attr_reader :some_attribute etc but you
2017 Aug 23
5
Extending TableGen's 'foreach' to work with 'multiclass' and 'defm'
On 08/23/2017 12:06 PM, Krzysztof Parzyszek via llvm-dev wrote: > On 8/23/2017 11:58 AM, Hal Finkel via llvm-dev wrote: >> If we want to go down that route, I can certainly imagine a feasible >> incremental-transitioning strategy. We could allow TableGen to use an >> embedded Python interpreter to generate records based on Python data >> structures, and then, combine
2013 Mar 02
0
Problems getting rspec testing working in OSX?
...Appreciate any help anyone can offer. I had the same error before I installed puppet from gems, suspected that installing the gem might help, but no; no change: http://pastie.org/private/b34pv87osbefarl77j5m5g kiera:apache loiosh$ gem list *** LOCAL GEMS *** diff-lcs (1.2.1) facter (1.6.17) metaclass (0.0.1) mocha (0.13.2) puppet (2.7.20) puppet-lint (0.3.2, 0.1.13) puppet-module (0.3.4) puppetlabs_spec_helper (0.4.1) rake (10.0.3) rspec (2.13.0) rspec-core (2.13.0) rspec-expectations (2.13.0) rspec-mocks (2.13.0) rspec-puppet (0.1.6) kiera:apache loiosh$ pwd /etc/puppet/modules/apache kiera...
2007 Oct 03
3
manually invoking routing?
Hey folks. I have a rails controller which is filtering search results for access control. The search results are typically URLs into the rest of the rails app. I''m finding it would simplify the grotty code which is accumulating if I could manually invoke the router. That is to say, if I could send something a URI path string and get back the hash of controller, action, and params that
2005 May 20
0
[LLVMdev] PyPy 0.6 released
...ng efforts towards low-level translation and experimenting with unique features. * By default, PyPy is a Python version that works completely with new-style-classes semantics. However, support for old-style classes is still available. Implementations, mostly as user-level code, of their metaclass and instance object are included and can be re-made the default with the ``--oldstyle`` option. * In PyPy, bytecode interpretation and object manipulations are well separated between a bytecode interpreter and an *object space* which implements operations on objects. PyPy comes with ex...
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
2013 Jun 29
0
rake db:create giving undefined method `' for nil:NilClass
My ruby version is 1.8.7 I have installed mysql-essential-5.0.90-win32 and using Fedena 2.3.5 List of all gems installed:* columnize (0.3.6) declarative_authorization (0.5.1) fattr (2.2.1) ffi (1.9.0) gem_plugin (0.2.3) highline (1.6.19) i18n (0.4.2) metaclass (0.0.1) mime-types (1.23) mocha (0.14.0) mongrel (1.1.5) mysql (2.8.1) net-ping (1.6.0) prawn (0.6.3) prawn-core (0.6.3) prawn-format (0.2.3) prawn-layout (0.3.2) prawn-security (0.1.1) rack (1.5.2, 1.0.1) rack-protection (1.5.0) rails (2.3.5) rake (0.8.7) rbx-require-relative (0.0.9) rest-client (...
2006 Oct 20
7
MVC and modules. Views telling models to behave
I was thinking today, it would be nice if a view could tell a model how to format it''s data for that particular view. Kind of like, the view is bestowing instant, and temporary knowledge on the model for the duration of the views run. It seemed to me that this would be more objecty than say a helper that formats a string format_my_string( my_string ) Instead, in my view. Lets assume I