Class: Attribool::AttributeList

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(*attributes) ⇒ AttributeList

Construct the list.

Parameters:

  • *attributes (String, Symbol)


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.

Parameters:

  • *attribute_names (String, Symbol)

Returns:



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