Class: Generic::Target
- Inherits:
-
Object
- Object
- Generic::Target
- Extended by:
- Forwardable
- Defined in:
- lib/generic/target.rb
Instance Attribute Summary collapse
-
#attr_reader ⇒ Object
readonly
Returns the value of attribute attr_reader.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #apply(&handler) ⇒ Object
-
#initialize(p) ⇒ Target
constructor
A new instance of Target.
Constructor Details
Instance Attribute Details
#attr_reader ⇒ Object (readonly)
Returns the value of attribute attr_reader.
8 9 10 |
# File 'lib/generic/target.rb', line 8 def attr_reader @attr_reader end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
8 9 10 |
# File 'lib/generic/target.rb', line 8 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
8 9 10 |
# File 'lib/generic/target.rb', line 8 def response @response end |
Instance Method Details
#apply(&handler) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/generic/target.rb', line 40 def apply(&handler) data = instance_eval(&handler) data.respond_to?(:each) ? response.body = data : response.write(data) .finish!(response) if @cookies response end |