class Attribool::AttributeList
Enumerable class that generates a list of attributes from a list of strings or symbols.
Public Class Methods
Source
# 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
Create an AttributeList from a list of attribute names.
@param [String, Symbol] *attribute_names
@kwarg [nil, String, Symbol, Proc] method_name
@return [AttributeList]
Source
# File lib/attribool/attribute_list.rb, line 38 def initialize(*attributes) ValidatorService.call(:attribute_list, *attributes) @entries = attributes end
Construct the list.
@param [String, Symbol] *attributes
Public Instance Methods
Source
# File lib/attribool/attribute_list.rb, line 20 def_delegators :@entries, :each
Yield every entry in the list to a block.
@param [block] &block
@return [Enumerable]