Class: Test::Unit::AttributeMatcher
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/test/unit/attribute-matcher.rb |
Class Method Summary
- .new(test) ⇒ AttributeMatcher constructor
Instance Method Summary
Constructor Details
.new(test) ⇒ AttributeMatcher
# File 'lib/test/unit/attribute-matcher.rb', line 4
def initialize(test) @test = test end
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args)
[ GitHub ]# File 'lib/test/unit/attribute-matcher.rb', line 17
def method_missing(name, *args) if args.empty? @test[name] else super end end
Instance Method Details
#match?(expression) ⇒ Boolean
# File 'lib/test/unit/attribute-matcher.rb', line 8
def match?(expression) matched = instance_eval(expression) if matched.nil? false else matched end end