Displaying 11 results from an estimated 11 matches for "somemodule".
2007 Jan 17
1
include ClassMethods in plugins
Why is that in so many plugins I see people using (including
acts_as_taggable by DHH):
# init.rb
ActiveRecord::Base.send(:include, ActiveRecord::Acts::SomeModule)
# lib/some_module.rb
module ActiveRecord
module Acts
module SomeModule
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def acts_as_something
# code
end
end
end
end
end
why go through all that rather...
2005 Aug 10
1
using modules with models?
...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 tried creating a class SomeModule::SomeClass. I have a file named
''some_class.rb'' in app/models/some_module. I keep getting this:
/usr/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/dependencies.rb:186:in
`const_missing'': uninitialized constant SomeClass (NameError)
So, I tried creating...
2015 Oct 27
3
Add a mapping to a C++ lambda
...;#include "llvm/IR/IRBuilder.h"#include
"llvm/Support/ManagedStatic.h"#include "llvm/Support/TargetSelect.h"
using namespace llvm;
int main() {
InitializeNativeTarget();
LLVMContext Context;
std::unique_ptr<Module> Owner = make_unique<Module>("SomeModule", Context);
Module *M = Owner.get();
FunctionType *lambdaFT = FunctionType::get(Type::getInt32Ty(Context), false);
Function *lambdaFN = Function::Create(lambdaFT,
Function::ExternalLinkage, "lambda", Owner.get());
auto lambdaBody = []() { return 100; };
Function *mainF =...
2007 Apr 30
7
Migrating spec_helper with modifications
Hello,
After moving into the HEAD of rspec, I am greeted with a mountain of errors,
which I expected, due to my specs not being migrated.
I use hpricot for a lot of my view tests, as it is extremely simple to
traverse the DOM with it. I used to include HpricotSpecHelper in
spec_helper.rb, like so:
require ''hpricot_spec_helper''
module Spec
module Rails
module Runner
2012 Oct 18
0
unexpected return (LocalJumpError) only when executing this code within autoloaded classes?
Posted on stackoverflow but no traction yet:
http://stackoverflow.com/questions/12942505/why-does-using-set-trace-func-work-in-some-places-but-cause-unexpected-return-l
The following is a generified part of the code in a gem I''m working on:
module SomeModule
class << self
attr_accessor :procedure
def log_events(*args)
args.flatten!
if args.size == 1
eval "set_trace_func proc {|event, file, line, id, binding,
classname| begin; SomeModule.procedure.call(event, file, line, id, binding,...
2012 Dec 17
20
early clean exit from module?
Hi folks,
I''ve poked around the language reference, and havent found anything on this
so far. I''d like to be able to force a clean early exit from a module.
WITHOUT encasing the whole body of the module in an if statement.
What I''m looking for:
class somemodule {
#no this isnt going to be a global variable I''m just using that as an
example,
if $dont_load_module {
return happy
}
// blah blah normal module goes on here
}
What I''d like to AVOID:
class somemodule {
if $dont_load_module != true {
// body of module
/...
2004 Jan 23
2
[Bug 712] ssh does not properly utilize OS specified authentication methods on AIX
...|ASSIGNED
------- Additional Comments From dtucker at zip.com.au 2004-01-22 22:09 -------
This is specific to the account configuration. Without going into too much
detail, the problem is this: The accounts were configured with the following
AIX authentication settings:
SYSTEM=none
auth1=somemodule
auth2=none
The problem is sshd uses AIX's authenticate() function, which knows only SYSTEM,
not auth1 or auth2 (AFAIK those are the domain of ckuserID() which is documented
as obsolete, and would be very difficult to support sanely in sshd anyway).
I think the best sshd can do in this case is...
2013 May 13
2
Creating defined resources based on array of parameters.
Hi all,
With the goal of making my code a little more DRY, I am trying to define
resource parameters in an array of hashes, and then create defined
resources from these array items. I am having trouble figuring out the
syntax for accessing the hash values for the hash currently being worked on
("self?").
Here''s the code to make it clear:
##### Configuration arguments
2010 May 12
2
How to add an after_save callback on runtime on a particular instance
class User < AR
end
user = User.new
Let''s say that I have a user instance with me. After this record is
saved I want an after_save callback which would print the id of the
record.
The only catch is that I am not allowed to change the User class. How
can I accomplish my goal? Is that even possible to add an after_save
callback on a particular instance object. Any metaprogramming
2013 Jan 15
3
Multiple class calls via dashboard
...and using ENC.
I wish to control as much of the configuration of machines via the
dashboard.
However, I have a requirement to call a module/class multiple times and was
wondering if this is possible? in a normal manifest I''d do this with the
following:
node "somenode" {
somemodule::submodule { "first": key => ''value''; "second": key => ''value''
}
}
How can i do that with the dashboard? It seems to me that
class definitions need to include the ability to define variables So I
could create multiple classes calli...
2006 Sep 13
0
Fwd: Systemtap vs Dtrace web page corrections.
...es the arguments are. Just printing the value passed into the
function could give the user insite as to how the program works.
Useful in reverse engineering a proprietary driver.
since dtrace ignores the argument type until told to cast it or read
its value, it has no problem with this case.
fbt:somemodule::entry { printf ( "arg1= %ld arg2=%ld\n", arg1, arg2); }
It also comes into play when you are working with a precompiled script
trying to probe a function thats prototype has changed since the
script was last compiled.
>
> > When Systemtap gets userland probes its inferred v...