class Ruhoh::Plugins::Initializer

Attributes

block[R]
context[R]
name[R]

Public Class Methods

new(name, &block) click to toggle source
# File lib/ruhoh/plugins/initializer.rb, line 5
def initialize name, &block
  raise ArgumentError, "block required for initializer '#{name}'" unless block_given?
  @name, @block = name, block
end

Public Instance Methods

bind(ctx) click to toggle source
# File lib/ruhoh/plugins/initializer.rb, line 15
def bind ctx
  @context = ctx
  self
end
run(*args) click to toggle source
# File lib/ruhoh/plugins/initializer.rb, line 10
def run *args
  raise "Initializer '#{name}' need to be bound" unless context
  context.instance_exec *args, &block
end