Class: Attribool::AttributeList
- Inherits:
-
Object
- Object
- Attribool::AttributeList
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/attribool/attribute_list.rb
Overview
Enumerable class that generates a list of attributes from a list of strings or symbols.
Class Method Summary collapse
-
.build(*attribute_names, method_name: nil) ⇒ AttributeList
Create an
AttributeList
from a list of attribute names.
Instance Method Summary collapse
-
#initialize(*attributes) ⇒ AttributeList
constructor
Construct the list.
Constructor Details
#initialize(*attributes) ⇒ AttributeList
Construct the list.
38 39 40 41 |
# File 'lib/attribool/attribute_list.rb', line 38 def initialize(*attributes) ValidatorService.call(:attribute_list, *attributes) @entries = attributes end |
Class Method Details
.build(*attribute_names, method_name: nil) ⇒ AttributeList
Create an AttributeList
from a list of attribute names.
30 31 32 |
# File 'lib/attribool/attribute_list.rb', line 30 def self.build(*attribute_names, method_name: nil) new(*attribute_names.map { |a| Attribool::Attribute.new(a, method_name) }) end |