Class: MatcherContainer
- Inherits:
-
Object
- Object
- MatcherContainer
- Extended by:
- Enumerable
- Defined in:
- lib/usagi/matcher_container.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
- #each ⇒ Object
- #find_from_scenario(scenario_value) ⇒ Object
Instance Method Details
#[](name) ⇒ Object
20 21 22 |
# File 'lib/usagi/matcher_container.rb', line 20 def [](name) matchers[name.to_s.upcase] end |
#[]=(name, value) ⇒ Object
24 25 26 |
# File 'lib/usagi/matcher_container.rb', line 24 def []=(name, value) matchers[name.to_s.upcase] = value end |
#each ⇒ Object
6 7 8 9 10 |
# File 'lib/usagi/matcher_container.rb', line 6 def each matchers.each do |matcher| yield matcher end end |
#find_from_scenario(scenario_value) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/usagi/matcher_container.rb', line 12 def find_from_scenario(scenario_value) return nil unless scenario_value =~ /^([A-Z_]+)(\(.*\))?$/ matcher, args = matchers[$1], $2 args = eval("[#{args[1..-2]}]") if args return nil unless matcher [matcher, args] end |