From: James Edward Gray II Date: 2010-10-26T05:47:54+09:00 Subject: Re: DSL and indirection question On Oct 25, 2010, at 3:30 PM, Matt Lawrence wrote: > On Tue, 26 Oct 2010, James Edward Gray II wrote: > >> I'm not really getting what you are aiming for here. Can you show a simple example or two? > > I have a directory full of results from a security scan, on file per system. In that file each line starts with a rule number, like "12.34" and has a pass/fail/skipped result. I'm probably still not understanding well, but this seems pretty easy to model: class SecurityTest def self.parse(scan_result_line) new(*scan_result_line.to_s.split) end def initialize(rule, result) @rule = rule @result = result end attr_reader :rule def passed? @result == "pass" end def failed? @result == "fail" end def skipped? @result == "skipped" end end st = SecurityTest.parse("12.34 fail") puts st.rule p st.failed? Hope that helps. James Edward Gray II