Skip to content

Commit ef3e520

Browse files
author
Robert Mitwicki
committed
use active_support for symbolizing keys on hashes
1 parent 792c784 commit ef3e520

File tree

5 files changed

+7
-29
lines changed

5 files changed

+7
-29
lines changed

lib/rubycas-server-core/authenticator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class Authenticator
1111
# under @options and initializes @extra_attributes to an empty hash.
1212
def configure(options)
1313
raise ArgumentError, "options must be a Hash" unless options.kind_of? Hash
14-
@options = Hash.symbolize_keys(options)
15-
@extra_attributes = {}
14+
@options = options.with_indifferent_access
15+
@extra_attributes = HashWithIndifferentAccess.new
1616
end
1717

1818
# Override this to implement your authentication credential validation.

lib/rubycas-server-core/core_ext.rb

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/rubycas-server-core/settings.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
require 'yaml'
2+
require 'active_support/core_ext/hash'
3+
require 'active_support/hash_with_indifferent_access'
24

35
module RubyCAS
46
module Server
57
module Core
68
module Settings
79
extend self
810

9-
@_settings = {}
11+
@_settings = HashWithIndifferentAccess.new
1012
attr_reader :_settings
1113

1214
def load!(file_name)
13-
config = YAML::load_file(file_name)
14-
config = Hash.symbolize_keys(config)
15+
config = YAML::load_file(file_name).with_indifferent_access
1516
@_settings.merge!(config)
1617
end
1718

rubycas-server-core.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
1818
gem.require_paths = ["lib"]
1919

2020
gem.add_dependency "r18n-core"
21+
gem.add_dependency "activesupport", ">= 3.0"
2122
end

spec/rubycas-server-core/core_ext_spec.rb

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)