Module: Assertion::DSL::Attribute

Included in:
Guard
Defined in:
lib/assertion/dsl/attribute.rb

Overview

Allows adding aliases to ‘#object` method.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



29
30
31
# File 'lib/assertion/dsl/attribute.rb', line 29

def self.extended(klass)
  klass.__send__ :attr_reader, :object
end

Instance Method Details

#attribute(name) ⇒ undefined

Adds alias to the [#object] method

Parameters:

  • name (#to_sym)

Returns:

  • (undefined)

Raises:

  • (NameError)

    When a given name is either used by instance methods, or reserved by the ‘#state` method to be implemented later.



23
24
25
26
# File 'lib/assertion/dsl/attribute.rb', line 23

def attribute(name)
  __check_attribute__(name)
  alias_method name, :object
end