Class: SmartCore::Validator::AttributeSet Private
- Inherits:
-
Object
- Object
- SmartCore::Validator::AttributeSet
- Includes:
- Enumerable
- Defined in:
- lib/smart_core/validator/attribute_set.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #attributes ⇒ Hash<Symbol,SmartCore::Validator::Attribute> readonly private
Instance Method Summary collapse
- #add_attribute(attribute) ⇒ void (also: #<<) private
- #concat(attribute_set) ⇒ void private
- #dup ⇒ SmartCore::Validator::AttributeSet private
- #each(&block) ⇒ Enumerable private
- #initialize ⇒ void constructor private
Constructor Details
#initialize ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 22 |
# File 'lib/smart_core/validator/attribute_set.rb', line 19 def initialize @attributes = {} @access_lock = Mutex.new end |
Instance Attribute Details
#attributes ⇒ Hash<Symbol,SmartCore::Validator::Attribute> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/smart_core/validator/attribute_set.rb', line 13 def attributes @attributes end |
Instance Method Details
#add_attribute(attribute) ⇒ void Also known as: <<
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
29 30 31 |
# File 'lib/smart_core/validator/attribute_set.rb', line 29 def add_attribute(attribute) thread_safe { attributes[attribute.name] = attribute } end |
#concat(attribute_set) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
39 40 41 |
# File 'lib/smart_core/validator/attribute_set.rb', line 39 def concat(attribute_set) thread_safe { attributes.merge!(attribute_set.dup.attributes) } end |
#dup ⇒ SmartCore::Validator::AttributeSet
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 50 51 52 53 54 55 |
# File 'lib/smart_core/validator/attribute_set.rb', line 47 def dup thread_safe do self.class.new.tap do |duplicate| attributes.each_value do |attribute| duplicate.add_attribute(attribute.dup) end end end end |
#each(&block) ⇒ Enumerable
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
61 62 63 |
# File 'lib/smart_core/validator/attribute_set.rb', line 61 def each(&block) thread_safe { block_given? ? attributes.each_value(&block) : attributes.each_value } end |