Module: Assertion::Attributes

Included in:
Base, Guard
Defined in:
lib/assertion/attributes.rb

Overview

Module Attributes provides features to define and store a list of attributes shared by the [Assertion::Base] and [Assertion::Guard] classes

Instance Method Summary collapse

Instance Method Details

#attribute(*names) ⇒ undefined

Adds a new attribute or a list of attributes to the class

Parameters:

  • names (Symbol, Array<Symbol>)

Returns:

  • (undefined)

Raises:

  • (NameError)

    When the name is either used by instance attribute, or forbidden as a name of the method to be implemented later (not as an attribute)



29
30
31
32
# File 'lib/assertion/attributes.rb', line 29

def attribute(*names)
  @attributes = List[:symbolize][attributes + names]
  __check_attributes__
end

#attributesArray<Symbol>

List of attributes, defined for the class

Returns:

  • (Array<Symbol>)


14
15
16
# File 'lib/assertion/attributes.rb', line 14

def attributes
  @attributes ||= []
end