Namespaces on asserted objects

1 view
Skip to first unread message

Pierre

unread,
May 24, 2007, 10:39:44 AM5/24/07
to Rools Users
Hi guys,

Has anyone tried asserting an object with a namespace? It seems to
create all kinds of interesting things. I'll log a bug, but I wanted
to check whether there's something that I might be missing finrst.

It seems to go wonky at the creation of fact and/or the fact lookup,
but I haven't had time to go and dig too much. The 'parameter' check
also seems to fail whether you use the class name (TestClass) or the
fully qualified name (Test::TestClass)

Below is the debug log and the test script:

Cheers,
Pierre

Script:
~~~~~
module Test
class TestClass
attr_accessor :value
end
end

log = Logger.new STDOUT
log.level = 0
Rools::RuleSet.logger=log

rs = Rools::RuleSet.new do
rule 'one' do
condition{true}
consequence {puts "* #{test::testclass}"}
end
end

rs.assert(Test::TestClass.new)

log:
~~~

D, [2007-05-24T16:33:39.535177 #9138] DEBUG -- : creating facts:
test::testclass
D, [2007-05-24T16:33:39.535314 #9138] DEBUG -- : no parameters defined
for rule: one
D, [2007-05-24T16:33:39.535354 #9138] DEBUG -- : one is relevant
D, [2007-05-24T16:33:39.535396 #9138] DEBUG -- : evaluating: one
D, [2007-05-24T16:33:39.535441 #9138] DEBUG -- : rule one matched
D, [2007-05-24T16:33:39.535480 #9138] DEBUG -- : executing rule one
E, [2007-05-24T16:33:39.535568 #9138] ERROR -- : rule
RuleConsequenceError wrong number of arguments /Users/pierre/dev/tests/
mxframework/rules/test_rules.rb:23:in `test'
/test_rules.rb:23
/usr/local/lib/ruby/gems/1.8/gems/rools-0.2/lib/rools/
default_parameter_proc.rb:35:in `instance_eval'
/usr/local/lib/ruby/gems/1.8/gems/rools-0.2/lib/rools/
default_parameter_proc.rb:35:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rools-0.2/lib/rools/rule.rb:119:in
`call'
/usr/local/lib/ruby/gems/1.8/gems/rools-0.2/lib/rools/rule.rb:118:in
`each'
/usr/local/lib/ruby/gems/1.8/gems/rools-0.2/lib/rools/rule.rb:118:in
`call'
/usr/local/lib/ruby/gems/1.8/gems/rools-0.2/lib/rools/rule_set.rb:
327:in `evaluate'
/usr/local/lib/ruby/gems/1.8/gems/rools-0.2/lib/rools/rule_set.rb:
303:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rools-0.2/lib/rools/rule_set.rb:
303:in `evaluate'
/usr/local/lib/ruby/gems/1.8/gems/rools-0.2/lib/rools/rule_set.rb:
243:in `assert'
/test_rules.rb:36

Pat Cappelaere

unread,
May 24, 2007, 11:18:30 AM5/24/07
to rools...@googlegroups.com
Pierre,

This is not supported at this time. This would be an interesting feature to
add. It looks a little tricky. I tried a few things....
I might need to think about this a bit... Unless you want to fix it.
Pat.

Pat Cappelaere

unread,
May 24, 2007, 12:14:51 PM5/24/07
to rools...@googlegroups.com
Pierre,

I fixed it in SVN.
Check the test file: namespace_test.rb
:: are replaced by __

Let me know if this works for you.
V/R,
Pat.


> From: Pierre <pierre.v...@gmail.com>
> Reply-To: <rools...@googlegroups.com>
> Date: Thu, 24 May 2007 14:39:44 -0000
> To: Rools Users <rools...@googlegroups.com>
> Subject: [rools-users] Namespaces on asserted objects
>
>

Pierre

unread,
May 29, 2007, 3:39:45 AM5/29/07
to Rools Users
Thanks Pat. I've been off for a couple of days, but I'll have a look
today. Having a little trouble getting the 0.3 gem and/or source
right now, but I'll try again a little later.

Cheers,
Pierre

On May 24, 6:14 pm, Pat Cappelaere <cappela...@gmail.com> wrote:
> Pierre,
>
> I fixed it in SVN.
> Check the test file: namespace_test.rb
> :: are replaced by __
>
> Let me know if this works for you.
> V/R,
> Pat.
>

Pierre

unread,
May 31, 2007, 5:06:54 AM5/31/07
to Rools Users
Hi Pat,

Finally got round to building the gem and a quick test. It seems to
work as advertised, thanks.

Cheers,
Pierre

Reply all
Reply to author
Forward
0 new messages