Class: RIO::Match::Record::SelRej
Instance Method Summary collapse
- #always? ⇒ Boolean
- #class_tail ⇒ Object
- #init_always(reset = false) ⇒ Object
-
#initialize(therio, sel_args, rej_args) ⇒ SelRej
constructor
A new instance of SelRej.
- #inspect ⇒ Object
- #match?(val, recno) ⇒ Boolean
- #never? ⇒ Boolean
- #only_one_fixnum? ⇒ Boolean
- #ranges ⇒ Object
- #rangetops ⇒ Object
- #remove_passed_ranges(n) ⇒ Object
Constructor Details
Instance Method Details
#always? ⇒ Boolean
226 227 228 |
# File 'lib/rio/matchrecord.rb', line 226 def always?() @always == true end |
#class_tail ⇒ Object
219 220 221 |
# File 'lib/rio/matchrecord.rb', line 219 def class_tail self.class.to_s.sub(/^.+::/,'') end |
#init_always(reset = false) ⇒ Object
193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/rio/matchrecord.rb', line 193 def init_always(reset=false) if @sel.nil? and @rej.nil? !reset elsif @rej.nil? and @sel.always? true elsif @sel.nil? false elsif !@rej.nil? and @rej.always? false else nil end end |
#inspect ⇒ Object
222 223 224 225 |
# File 'lib/rio/matchrecord.rb', line 222 def inspect sprintf("#<%s:0x%08x @always=%s @sel=%s @rej=%s>",self.class_tail,self.object_id,@always.inspect, @sel.inspect,@rej.inspect) end |
#match?(val, recno) ⇒ Boolean
232 233 234 235 236 237 |
# File 'lib/rio/matchrecord.rb', line 232 def match?(val,recno) return @always if @always as = nil ok = ((@sel && (as = @sel.match?(val,recno))) && !(@rej && @rej.match?(val,recno))) return (ok ? as : ok) end |
#never? ⇒ Boolean
229 230 231 |
# File 'lib/rio/matchrecord.rb', line 229 def never?() @always == false end |
#only_one_fixnum? ⇒ Boolean
190 191 192 |
# File 'lib/rio/matchrecord.rb', line 190 def only_one_fixnum?() @rej.nil? && @sel && @sel.only_one_fixnum? end |
#ranges ⇒ Object
216 217 218 |
# File 'lib/rio/matchrecord.rb', line 216 def ranges() (@sel.nil? ? [] : @sel.ranges) + (@rej.nil? ? [] : @rej.ranges) end |
#rangetops ⇒ Object
212 213 214 215 |
# File 'lib/rio/matchrecord.rb', line 212 def rangetops() rtops = ranges.map { |r| r.val.max }.sort.uniq rtops.empty? ? nil : rtops end |
#remove_passed_ranges(n) ⇒ Object
206 207 208 209 210 211 |
# File 'lib/rio/matchrecord.rb', line 206 def remove_passed_ranges(n) @sel = @sel.remove_passed_ranges(n) unless @sel.nil? @rej = @rej.remove_passed_ranges(n) unless @rej.nil? @always = init_always(true) self end |