Class: Gopher::TextHandler

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

Instance Attribute Summary collapse

Attributes inherited from Handler

#app

Instance Method Summary collapse

Methods inherited from Handler

#bindto, #host, #port, #with

Constructor Details

#initialize(&block) ⇒ TextHandler

Returns a new instance of TextHandler.



107
108
109
# File 'lib/gopher.rb', line 107

def initialize(&block)
  @block = block
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



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

def block
  @block
end

#resultObject

Returns the value of attribute result.



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

def result
  @result
end

Instance Method Details

#call(*args) ⇒ Object



111
112
113
114
115
# File 'lib/gopher.rb', line 111

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