Sha256: da0e0d2ef4bedcb267a8cee1831363966573b8afc8a99a422b941127c6da5457
Contents?: true
Size: 981 Bytes
Versions: 3
Compression:
Stored size: 981 Bytes
Contents
# # Fortress is a protection mechanism for Rails applications # # @author zedtux # module Fortress class << self attr_accessor :configuration end def self.configure self.configuration ||= Configuration.new yield(configuration) apply_configuration! end # # Fortress configuration management class # # @author zedtux # class Configuration attr_reader :options def externals=(value) return unless value @options = { externals: externals_from(value) } end private def externals_from(value) case when value.is_a?(String) then [value] when value.is_a?(Array) then value end end end private def self.apply_configuration! if configuration.options.try(:key?, :externals) fortress_allow_externals!(configuration.options[:externals]) end end def self.fortress_allow_externals!(externals) externals.each { |name| Mechanism.authorise!(name, :all) } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fortress-0.2.3 | lib/fortress/configuration.rb |
fortress-0.2.2 | lib/fortress/configuration.rb |
fortress-0.2.1 | lib/fortress/configuration.rb |