Class: Request::Key

Inherits:
String
  • Object
show all
Defined in:
lib/request/key.rb

Overview

A string with cashed #hash for faster hash access

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize object

Parameters:

  • string (String)


22
23
24
25
26
# File 'lib/request/key.rb', line 22

def initialize(string)
  @hash = string.hash
  super(string)
  freeze
end

Instance Attribute Details

#hashFixnum (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return hash

Returns:

  • (Fixnum)


12
13
14
# File 'lib/request/key.rb', line 12

def hash
  @hash
end