Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/apache/apachify.rb,
lib/apache/hash.rb

Overview

Ruby hashes

Constant Summary collapse

REWRITE_RULE_CONDITIONS =
{
  :last => 'L',
  :forbidden => 'F',
  :no_escape => 'NE',
  :redirect => lambda { |val| val == true ? 'R' : "R=#{val}" },
  :pass_through => 'PT',
  :preserve_query_string => 'QSA',
  :query_string_append => 'QSA',
  :proxy => 'P',
  :env => lambda { |val| "E=#{val}" }
}

Instance Method Summary collapse

Instance Method Details

#rewrite_rule_optionifyObject



134
135
136
137
138
139
140
# File 'lib/apache/apachify.rb', line 134

def rewrite_rule_optionify
  self.collect do |key, value|
    what = REWRITE_RULE_CONDITIONS[key]
    what = what.call(value) if what.kind_of? Proc
    what
  end.compact.sort
end

#to_sym_keysObject



2
3
4
5
6
7
# File 'lib/apache/hash.rb', line 2

def to_sym_keys
  Hash[self.collect { |key, value|
    value = value.to_sym_keys if value.kind_of?(Hash)
    [ key.to_sym, value ]
  }]
end