Class: Sinja::RolesConfig
- Inherits:
-
Object
- Object
- Sinja::RolesConfig
- Extended by:
- Forwardable
- Includes:
- ConfigUtils
- Defined in:
- lib/sinja/config.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #freeze ⇒ Object
-
#initialize(actions = []) ⇒ RolesConfig
constructor
A new instance of RolesConfig.
- #initialize_copy(other) ⇒ Object
- #merge!(h = {}) ⇒ Object
Methods included from ConfigUtils
Constructor Details
#initialize(actions = []) ⇒ RolesConfig
Returns a new instance of RolesConfig.
200 201 202 |
# File 'lib/sinja/config.rb', line 200 def initialize(actions=[]) @data = actions.map { |action| [action, Roles.new] }.to_h end |
Instance Method Details
#==(other) ⇒ Object
206 207 208 |
# File 'lib/sinja/config.rb', line 206 def ==(other) @data == other.instance_variable_get(:@data) end |
#freeze ⇒ Object
224 225 226 227 |
# File 'lib/sinja/config.rb', line 224 def freeze deep_freeze(@data) super end |
#initialize_copy(other) ⇒ Object
219 220 221 222 |
# File 'lib/sinja/config.rb', line 219 def initialize_copy(other) super @data = deep_copy(other.instance_variable_get(:@data)) end |
#merge!(h = {}) ⇒ Object
210 211 212 213 214 215 216 217 |
# File 'lib/sinja/config.rb', line 210 def merge!(h={}) h.each do |action, roles| abort "Unknown or invalid action helper `#{action}' in configuration" \ unless @data.key?(action) @data[action].replace([*roles]) end @data end |