Richard Pruss
unread,Aug 31, 2009, 1:44:43 AM8/31/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruleby
I am trying to use Ruleby to parse some data, but I run into a strange
error.
"/Library/Ruby/Gems/1.8/gems/ruleby-0.5/lib/dsl/ferrari.rb:96:in
`when': The != operator is not allowed. (RuntimeError)"
Can one refer to an array in a rule.
class Line
def initialize(linein)
@rows = linein.chop.split(',')
@size = @rows.length
puts "Init line of #{@size} from #{@rows}"
end
attr_reader :rows,:size
def to_s
return @rows.to_s;
end
end
Here is the rule I am trying, I remove the array reference this works:
rule :ThreeinFourParse,
[Line,:line, m.size>=15,m.row[4]==3, {m.rows => :r}] do |vars|
rows = vars[:r]
puts "Rule fired for for #{rows}"
end
The array reference I suspect is not allowed, is that the case?
/Library/Ruby/Gems/1.8/gems/ruleby-0.5/lib/dsl/ferrari.rb:96:in
`when': The != operator is not allowed. (RuntimeError)
from /Library/Ruby/Gems/1.8/gems/ruleby-0.5/lib/dsl/ferrari.rb:81:in
`each'
from /Library/Ruby/Gems/1.8/gems/ruleby-0.5/lib/dsl/ferrari.rb:81:in
`when'
from /Library/Ruby/Gems/1.8/gems/ruleby-0.5/lib/dsl/ferrari.rb:27:in
`rule'
from /Library/Ruby/Gems/1.8/gems/ruleby-0.5/lib/dsl/ferrari.rb:25:in
`each'
from /Library/Ruby/Gems/1.8/gems/ruleby-0.5/lib/dsl/ferrari.rb:25:in
`rule'
from /Library/Ruby/Gems/1.8/gems/ruleby-0.5/lib/rulebook.rb:51:in
`rule'
from ./lib/ParseLine.rb:87:in `rules'
from ./lib/FileTail.rb:40:in `file_tail'
from /Library/Ruby/Gems/1.8/gems/ruleby-0.5/lib/ruleby.rb:19:in
`engine'
from ./lib/FileTail.rb:39:in `file_tail'
from ./ee.rb:143:in `process_command'
from ./ee.rb:72:in `run'
from ./ee.rb:168
-Ric