Class: Strict::Attributes::Configuration
- Inherits:
-
Object
- Object
- Strict::Attributes::Configuration
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/strict/attributes/configuration.rb
Defined Under Namespace
Classes: UnknownAttributeError
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attributes:) ⇒ Configuration
constructor
A new instance of Configuration.
- #named!(name) ⇒ Object
Constructor Details
#initialize(attributes:) ⇒ Configuration
Returns a new instance of Configuration.
32 33 34 35 |
# File 'lib/strict/attributes/configuration.rb', line 32 def initialize(attributes:) @attributes = attributes @attributes_index = attributes.to_h { |a| [a.name, a] } end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
30 31 32 |
# File 'lib/strict/attributes/configuration.rb', line 30 def attributes @attributes end |
Instance Method Details
#named!(name) ⇒ Object
37 38 39 |
# File 'lib/strict/attributes/configuration.rb', line 37 def named!(name) attributes_index.fetch(name) { raise UnknownAttributeError.new(attribute_name: name) } end |