Class: Rack::Utils::Context

Inherits:
Proc
  • Object
show all
Defined in:
lib/rack/utils.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_f = nil, app_r = nil) ⇒ Context

Returns a new instance of Context.



76
77
78
# File 'lib/rack/utils.rb', line 76

def initialize app_f=nil, app_r=nil
  @for, @app = app_f, app_r
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



75
76
77
# File 'lib/rack/utils.rb', line 75

def app
  @app
end

#forObject (readonly)

Returns the value of attribute for.



75
76
77
# File 'lib/rack/utils.rb', line 75

def for
  @for
end

Instance Method Details

#inspectObject



80
81
82
# File 'lib/rack/utils.rb', line 80

def inspect
  "#{old_inspect} ==> #{@for.inspect} ==> #{@app.inspect}"
end

#old_inspectObject



79
# File 'lib/rack/utils.rb', line 79

alias_method :old_inspect, :inspect

#pretty_print(pp) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/rack/utils.rb', line 83

def pretty_print pp
  pp.text old_inspect
  pp.nest 1 do
    pp.breakable
    pp.text '=for> '
    pp.pp @for
    pp.breakable
    pp.text '=app> '
    pp.pp @app
  end
end