Class: Rfix::CLI::Command::Extension

Inherits:
Module
  • Object
show all
Includes:
Dry::Core::Constants
Defined in:
lib/rfix/cli/command/extension.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, &block) ⇒ Extension

Returns a new instance of Extension.



11
12
13
# File 'lib/rfix/cli/command/extension.rb', line 11

def initialize(method, &block)
  define_method(method, &block)
end

Class Method Details

.call(source, method, value = Undefined, &block) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/rfix/cli/command/extension.rb', line 15

def self.call(source, method, value = Undefined, &block)
  unless block_given?
    return call(source, method, &value.method(:itself))
  end

  source.include(new(method, &block))
end