class Hanami::Utils::ClassAttribute::Attributes
Class
attributes set
@since 2.0.0 @api private
Public Class Methods
new(attributes: Concurrent::Map.new)
click to toggle source
@since 2.0.0 @api private
# File lib/hanami/utils/class_attribute/attributes.rb, line 15 def initialize(attributes: Concurrent::Map.new) @attributes = attributes end
Public Instance Methods
[](key)
click to toggle source
@since 2.0.0 @api private
# File lib/hanami/utils/class_attribute/attributes.rb, line 27 def [](key) @attributes.fetch(key, nil) end
[]=(key, value)
click to toggle source
@since 2.0.0 @api private
# File lib/hanami/utils/class_attribute/attributes.rb, line 21 def []=(key, value) @attributes[key.to_sym] = value end
dup()
click to toggle source
@since 2.0.0 @api private
# File lib/hanami/utils/class_attribute/attributes.rb, line 33 def dup attributes = Concurrent::Map.new.tap do |attrs| @attributes.each do |key, value| attrs[key.to_sym] = value.dup end end self.class.new(attributes: attributes) end