Class: Graham::TestCase
- Inherits:
-
Struct
- Object
- Struct
- Graham::TestCase
- Defined in:
- lib/graham/test_case.rb
Overview
A struct for encapsulating test cases. Memoizes the case’s return value.
Defined Under Namespace
Classes: Proxy
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#blk ⇒ Object
Returns the value of attribute blk.
-
#msg ⇒ Object
Returns the value of attribute msg.
-
#obj ⇒ Object
Returns the value of attribute obj.
Instance Method Summary collapse
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args
4 5 6 |
# File 'lib/graham/test_case.rb', line 4 def args @args end |
#blk ⇒ Object
Returns the value of attribute blk
4 5 6 |
# File 'lib/graham/test_case.rb', line 4 def blk @blk end |
#msg ⇒ Object
Returns the value of attribute msg
4 5 6 |
# File 'lib/graham/test_case.rb', line 4 def msg @msg end |
#obj ⇒ Object
Returns the value of attribute obj
4 5 6 |
# File 'lib/graham/test_case.rb', line 4 def obj @obj end |
Instance Method Details
#go ⇒ Object
5 6 7 |
# File 'lib/graham/test_case.rb', line 5 def go defined?(@val) ? @val : (@val = obj.send msg, *args, &blk) end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/graham/test_case.rb', line 9 def to_s "#{Class===obj ? '::' : ?#}#{msg}(#{args.join ', '})#{" {...}" if blk}" end |