So, I have a set of rules that are all designed to validate a set of
compliance rules in my dataset. I don't want Ruleby to take any action
on the data, just report back violations to my pre defined rules.
Example:
class Dog
attr_accessor :legs
attr_accessor :spots
end
class DogRulebook < Ruleby::Rulebook
def dog_issues
rule [ Dog, :d, m.spots == 2, m.legs.not== 4] do |v|
puts "Dogs with two spots must have 4 legs"
end
end
Now that I need to move beyond the puts and start collecting real
information into an array, or into an instance of a class built just
to hold and modify rule violations, I can't figure out the next move.
I think, fundamentally, I find the whole thing a black box. I don't
really understand the scope that the matching occurs in. How would I
get data out of the class, i.e.:
class DogRulebook < Ruleby::Rulebook
def dog_issues
rule [ Dog, :d, m.spots == 2, m.legs.not== 4] do |v|
array_that_holds_all_the_violations << "Dogs with two spots must
have 4 legs"
end
end
Also, and probably more the direction I'm interesting in heading, what
about passing data in and out:
array_with_data_that_will_get_more = ['x', 'y']
class DogRulebook < Ruleby::Rulebook
def dog_issues
rule [ Dog, :d, m.spots == 2, m.legs.not== 4] do |v|
array_with_data_that_will_get_more << "Dogs with two spots must
have 4 legs"
end
end
Is this even the correct way of using the module? Am I only supposed
to use facts I've asserted and manipulate only those objects? If so,
do I just pass in this array as a fact? How do I get it out again? I'm
I _completely_ off base trying to use Ruleby like this for data
validation? Oi.
Well, if anyone understands the point at which I'm stuck, and knows of
some additional documentation to help me get past this point, I'd
greatly appreciate it.
- Mike Karolow
--
You received this message because you are subscribed to the Google Groups "Ruleby" group.
To post to this group, send email to rul...@googlegroups.com.
To unsubscribe from this group, send email to ruleby+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ruleby?hl=en.
> > ruleby+un...@googlegroups.com<ruleby%2Bunsu...@googlegroups.com>