Class: Yargi::IndexPredicate

Inherits:
Predicate show all
Defined in:
lib/yargi/predicate.rb

Overview

Index predicate

Constant Summary

Constants inherited from Predicate

Predicate::ALL, Predicate::NONE

Instance Method Summary collapse

Methods inherited from Predicate

#&, #not, to_predicate, #|

Constructor Details

#initialize(index) ⇒ IndexPredicate

Returns a new instance of IndexPredicate.



224
225
226
# File 'lib/yargi/predicate.rb', line 224

def initialize(index)
  @index = index
end

Instance Method Details

#===(elm) ⇒ Object



228
229
230
# File 'lib/yargi/predicate.rb', line 228

def ===(elm)
  elm.index == @index
end

#inspectObject



232
233
234
# File 'lib/yargi/predicate.rb', line 232

def inspect
  "elm.index == #{index}"
end