Module: Decorations
- Defined in:
- lib/decorations.rb,
lib/decorations/version.rb
Overview
Decorations class to extend within your class
Constant Summary collapse
- VERSION =
The version of the Ruby-decorations gem
'1.1.1'
Class Method Summary collapse
-
.extended(receiver) ⇒ Void
private
Injects the decorated_methods attribute in the class received.
Instance Method Summary collapse
-
#decorate(klass, *args, &block) ⇒ Void
Decorates a method execute’s the klass’ #call method around the decorated method.
Class Method Details
.extended(receiver) ⇒ Void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Injects the decorated_methods attribute in the class received
17 18 19 20 21 |
# File 'lib/decorations.rb', line 17 def self.extended(receiver) class << receiver attr_accessor :decorated_methods end end |
Instance Method Details
#decorate(klass, *args, &block) ⇒ Void
Decorates a method execute’s the klass’ #call method around the decorated method
51 52 53 54 |
# File 'lib/decorations.rb', line 51 def decorate(klass, *args, &block) @decorators ||= [] @decorators << { klass: klass, args: args, block: block } end |