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