Class: Guard::Watcher::Pattern::MatchResult
- Inherits:
-
Object
- Object
- Guard::Watcher::Pattern::MatchResult
- Defined in:
- lib/guard/watcher/pattern/match_result.rb
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(match_result, original_value) ⇒ MatchResult
constructor
A new instance of MatchResult.
Constructor Details
#initialize(match_result, original_value) ⇒ MatchResult
Returns a new instance of MatchResult.
5 6 7 8 |
# File 'lib/guard/watcher/pattern/match_result.rb', line 5 def initialize(match_result, original_value) @match_result = match_result @original_value = original_value end |
Instance Method Details
#[](index) ⇒ Object
10 11 12 13 14 |
# File 'lib/guard/watcher/pattern/match_result.rb', line 10 def [](index) return @match_result[index] if index.is_a?(Symbol) return @original_value if index.zero? @match_result.to_a[index] end |