Class: Gopher::TextHandler

Inherits:
Handler show all
Defined in:
lib/gopher.rb

Instance Attribute Summary collapse

Attributes inherited from Handler

#application

Instance Method Summary collapse

Methods inherited from Handler

#host, #port, #with

Constructor Details

#initialize(&block) ⇒ TextHandler

Returns a new instance of TextHandler.



104
105
106
# File 'lib/gopher.rb', line 104

def initialize(&block)
  @block = block
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



102
103
104
# File 'lib/gopher.rb', line 102

def block
  @block
end

#resultObject

Returns the value of attribute result.



102
103
104
# File 'lib/gopher.rb', line 102

def result
  @result
end

Instance Method Details

#call(*args) ⇒ Object



108
109
110
111
112
# File 'lib/gopher.rb', line 108

def call(*args)
  context = TextContext.new
  context.instance_exec(*args, &block)
  context.result
end