Sha256: ca79ef23ee6ae1169bbff1de20eebb61306b8ff6ff9b0e3aa30f1259d513784a

Contents?: true

Size: 807 Bytes

Versions: 44

Compression:

Stored size: 807 Bytes

Contents

module Radius
  module Utility # :nodoc:
    def self.symbolize_keys(hash)
      new_hash = {}
      hash.keys.each do |k|
        new_hash[k.to_s.intern] = hash[k]
      end
      new_hash
    end
    
    def self.impartial_hash_delete(hash, key)
      string = key.to_s
      symbol = string.intern
      value1 = hash.delete(symbol)
      value2 = hash.delete(string)
      value1 || value2
    end
    
    def self.constantize(camelized_string)
      raise "invalid constant name `#{camelized_string}'" unless camelized_string.split('::').all? { |part| part =~ /^[A-Za-z]+$/ }
      Object.module_eval(camelized_string)
    end
    
    def self.camelize(underscored_string)
      string = ''
      underscored_string.split('_').each { |part| string << part.capitalize }
      string
    end
  end
end

Version data entries

44 entries across 44 versions & 7 rubygems

Version Path
depengine-0.0.31 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.30 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.29 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.28 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.27 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.26 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.25 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.24 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.23 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.22 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.21 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.20 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.19 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.18 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.17 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.16 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.15 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.14 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.13 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb
depengine-0.0.12 etc/isolate/jruby-1.8/gems/radius-0.6.1/lib/radius/utility.rb