Class: Wrapper
- Inherits:
-
Object
- Object
- Wrapper
- Defined in:
- lib/nrser/rspex.rb
Instance Method Summary collapse
-
#initialize(description: nil, &block) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #to_s ⇒ Object
- #unwrap(context: nil) ⇒ Object
Constructor Details
#initialize(description: nil, &block) ⇒ Wrapper
Returns a new instance of Wrapper.
52 53 54 55 |
# File 'lib/nrser/rspex.rb', line 52 def initialize description: nil, &block @description = description @block = block end |
Instance Method Details
#to_s ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/nrser/rspex.rb', line 65 def to_s if @description @description.to_s else "#<Wrapper ?>" end end |
#unwrap(context: nil) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/nrser/rspex.rb', line 57 def unwrap context: nil if context context.instance_exec &@block else @block.call end end |