File: match_result.rb

package info (click to toggle)
ruby-guard 2.18.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,344 kB
  • sloc: ruby: 9,256; makefile: 6
file content (18 lines) | stat: -rw-r--r-- 426 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Guard
  class Watcher
    class Pattern
      class MatchResult
        def initialize(match_result, original_value)
          @match_result = match_result
          @original_value = original_value
        end

        def [](index)
          return @match_result[index] if index.is_a?(Symbol)
          return @original_value if index.zero?
          @match_result.to_a[index]
        end
      end
    end
  end
end