search for: instance_ev

Displaying 20 results from an estimated 151 matches for "instance_ev".

Did you mean: instance_eval
2007 Aug 08
5
and_yield + instance_eval(&block)
I have the following code, which yields instance eval''s the block given: class Foo def bar(&blk) instance_eval &blk end def baz yield end end The effect of this is that self is reassigned: Foo.new.bar do # here, self is the instance of Foo # created by new end But normally self is the object in which Foo.new.bar {...} occurs. Foo.new.baz do # self is the execution conte...
2006 Feb 10
1
instance_eval and Proc objects
Hi All, Got a bit of a Ruby question for you. If I have a function that makes a proc object like this: def select(selector, &proc) el = Element.new el.instance_eval proc end select("#thing") do hide end Wat I want to do is evaluate the Proc in the context of el but this doesn''t work because instance_eval accepts a string or a block and not a Proc object. I sense Im barking up the wrong tree here entirely but Im pretty new to this Rub...
2006 Jun 26
1
ActiveRecord, instance_eval, and PStore
I''m trying to add some per-object behaviors to objects descended from ActiveRecord, by using after_initialize() and instance_eval(), like this: def after_initialize self.instance_eval(File.read(''customers/default.rb'')) end (Ultimately the file path will be dynamic, this is just proof of concept.) default.rb just contains a few method definitions like this one: def support_phone_num "1-800-OBI...
2006 Jun 15
1
Problem with deployment on TextDrive using shovel script
...uby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/configuration.rb: 237:in `method_missing'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/scm/subversion.rb :72:in `checkout'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard. rb:70:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard. rb:67:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:125:in ` instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/act...
2006 Jun 27
3
Weird ActiveRecord Foreign Key Problem
...have a table named "build_order" with a column named "type" that is a foreign key to a table called "building_type". In a controller I try to read all the build_orders with "BuildOrder.find :all" and get the following error and stack trace: (eval):1:in `instance_eval'': compile error (eval):1: syntax error Object::0 ^ c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1244:in `instance_eval'' c:/programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1244:in `instance_...
2007 Sep 27
10
Adding more sugar to wxSugar
...lization code and to embed all other things (like calling the main_loop method for an app). class CandyApp < Wx::App attr_accessor :init_block def self.create &block # Create and run the application app = new app.init_block = block app.main_loop end def on_init instance_eval &init_block true end end class CandyFrame < Wx::Frame def self.create *args, &block frame = new args frame.instance_eval &block frame end def initialize args super *args end end Given these simple additional classes, the minimal app sample can be w...
2006 Jun 28
2
[PATCH] Bug fixes and additions to scoped_access
...es not re-evaluate the filters on every run. If you are filtering access based on parameters, this can be bad. The scope is set on the first request and then further requests use the last generated scoping. The initial part of 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.i...
2005 Nov 07
5
Switchtower deployment
Hi, Has anyone experiences using SwitchTower (Windows) in a shared hosting environment (Textdrive)? I already patched the SwitchTower rake tasks (I don''t know if someone is interested on it), but i still experience some problems (not in the sudoers list, ...). Thank you for answer (and thank you to the textdrive guys, i never had a such fast support!) -- Jean-Etienne Durand
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 a block, and eval the block in th...
2009 Sep 10
2
passenger with ruby enterprise edition
...ire'' from /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'' from config.ru:8 from /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.5/vendor/rack-1.0.0-git/lib/rack/builder.rb:29:in `instance_eval'' from /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.5/vendor/rack-1.0.0-git/lib/rack/builder.rb:29:in `initialize'' from config.ru:1:in `new'' from config.ru:1 *** Exception LoadError in PhusionPassenger::Rack::Applicatio...
2006 Dec 14
8
ActiveRecord outside of rails
I have a few questions regarding using activerecord outside of rails. Usage is with legacy databases, which gives rise to some of the problems. Probably the first, and most simple question though, is how to capture the SQL log, with which I can hopefully figure the other stuff out. I''m currently trying ActiveRecord::Base.logger = Logger.new STDOUT Based on random googles, but it
2007 Nov 06
5
textarea fails on rows attribute
...2:in `tag!'' c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:217:in `html_tag'' (eval):3:in `input'' C:/Documents and Settings/djberge/workspace/cluri/cluri.rb:118:in `index'' c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:123:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:123:in `capture'' c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:155:in `tag!'' (eval):92:in `tag!'' c:/ruby/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:217:in `htm...
2006 Dec 21
1
need some guidance with a test
This is part of a rails project. The following method is part of the Ams class (a rails model). I''m a bit unsure of the rspec/bdd way of testing this method. def persist_as_domains @current_domains.each do |d| dom = Domain.new dom.domain = d dom.source_id = 1 dom.at = Time.now dom.save end end The following is what came out when I tried to write my test. Notice
2011 Jun 02
10
Application Error!!!!!!!!!!!!!!!!!!!!!!!
...#39;' [36m2011-06-02T09:20:20+00:00 app[web.1]:←[0m from /home/heroku_rack/heroku.ru:29:in `new'' [36m2011-06-02T09:20:20+00:00 app[web.1]:←[0m from /home/heroku_rack/heroku.ru:29 [36m2011-06-02T09:20:20+00:00 app[web.1]:←[0m from /app/.gems/gems/rack-1.1.2/lib/rack/builder.rb:46:in `instance_eval'' [36m2011-06-02T09:20:20+00:00 app[web.1]:←[0m from /app/.gems/gems/rack-1.1.2/lib/rack/builder.rb:46:in `initialize'' [36m2011-06-02T09:20:20+00:00 app[web.1]:←[0m from /app/.gems/gems/rack-1.1.2/lib/rack/builder.rb:63:in `new'' [36m2011-06-02T09:20:20+00:00 app[web.1]...
2006 Jan 26
0
Switchtower deploy failing...
...tower-0.10.0/lib/switchtower/configuration.rb:195:in `method_missing'' from /usr/lib/ruby/gems/1.8/gems/switchtower-0.10.0/lib/switchtower/scm/cvs.rb:48:in `checkout'' from /usr/lib/ruby/gems/1.8/gems/switchtower-0.10.0/lib/switchtower/recipes/standard.rb:67:in `instance_eval'' from /usr/lib/ruby/gems/1.8/gems/switchtower-0.10.0/lib/switchtower/actor.rb:114:in `update_code'' from /usr/lib/ruby/gems/1.8/gems/switchtower-0.10.0/lib/switchtower/recipes/standard.rb:138:in `instance_eval'' from /usr/lib/ruby/gems/1.8/gem...
2007 Jan 24
3
Another ''found a bug'' problem - This time with user purging.
Ok, given the statement on the web page about unlesssystemuser under Resources ( http://reductivelabs.com/projects/puppet/documentation/typedocs.html#resources), I assume that users can be purged. However, when I attempt to do this with resources { user: purge => true, noop => true } and what I get is: err: Found a bug: private method ''split'' called for nil:NilClass.
2006 May 26
3
capistrano on windows (again)
...39; c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:424:in `execute_on_servers'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:173:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard.rb:39:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard.rb:38:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:125:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/acto...
2006 Mar 27
2
:through and STI
...meError: ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:89:in `const_missing'': uninitialized constant Players from ./script/../config/../config/../vendor/rails/activerecord/lib/active_record/base.rb:1197:in `instance_eval'' from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:120:in `const_missing'' from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/depend...
2012 Sep 18
2
Access block scope from AR object
I need to create a sort of transaction around some Active Record objects that perform many insert/updates. Example: class MyObject def transaction &block @my_var = value self.instance_eval block end end MyObject.new.transaction do Model.create Model.collection.create etc...... end I have a gem that add a method into AR::Base and I need to read the variables setted by the transaction inside the method at runtime. Any way I can access the block scope from there i...
2006 May 24
0
capistrano on windows
...39; c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:424:in `execute_on_servers'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:173:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard.rb:39:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard.rb:38:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:125:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/acto...