Module: Assertion::DSL::Attributes
- Included in:
- Base
- Defined in:
- lib/assertion/dsl/attributes.rb
Overview
Allows adding aliases to values of the ‘#attributes` hash.
Class Method Summary collapse
Instance Method Summary collapse
-
#attribute(*names) ⇒ undefined
Declares new attribute(s) by name(s).
-
#attributes ⇒ Array<Symbol>
List of declared attributes.
Class Method Details
.extended(klass) ⇒ Object
34 35 36 |
# File 'lib/assertion/dsl/attributes.rb', line 34 def self.extended(klass) klass.__send__(:define_method, :attributes) { @attributes ||= {} } end |
Instance Method Details
#attribute(*names) ⇒ undefined
Declares new attribute(s) by name(s)
29 30 31 |
# File 'lib/assertion/dsl/attributes.rb', line 29 def attribute(*names) names.flatten.map(&:to_sym).each(&method(:__add_attribute__)) end |
#attributes ⇒ Array<Symbol>
List of declared attributes
15 16 17 |
# File 'lib/assertion/dsl/attributes.rb', line 15 def attributes @attributes ||= [] end |