Class: Line::Matchers::Index

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/line/matchers/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#inspect_helper

Constructor Details

#initialize(index) ⇒ Index

Returns a new instance of Index.



10
11
12
# File 'lib/line/matchers/index.rb', line 10

def initialize(index)
  self.index = index
end

Instance Attribute Details

#indexObject

Returns the value of attribute index.



8
9
10
# File 'lib/line/matchers/index.rb', line 8

def index
  @index
end

Instance Method Details

#inspect(parent = false) ⇒ Object



18
19
20
# File 'lib/line/matchers/index.rb', line 18

def inspect(parent=false)
  inspect_helper parent, index.to_s, false
end

#matches?(line, positive_index, negative_index) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/line/matchers/index.rb', line 14

def matches?(line, positive_index, negative_index)
  positive_index == index || negative_index == index
end