Module: Rack::Component::Methods::InstanceMethods

Defined in:
lib/rack/component.rb

Overview

Instances of Rack::Component come with these methods. :reek:ModuleInitialize

Instance Method Summary collapse

Instance Method Details

#envHash

env can be an empty hash, but cannot be nil

Returns:

  • (Hash)


43
44
45
# File 'lib/rack/component.rb', line 43

def env
  @env || {}
end

#h(obj) ⇒ String

h removes HTML characters from strings via CGI.escapeHTML.

Returns:

  • (String)


49
50
51
# File 'lib/rack/component.rb', line 49

def h(obj)
  CGI.escapeHTML(obj.to_s)
end

#initialize(env) ⇒ Object

env is Rack::Component’s version of React’s props hash.



37
38
39
# File 'lib/rack/component.rb', line 37

def initialize(env)
  @env = env
end