Class: BangBang::Plugins::Set

Inherits:
Object
  • Object
show all
Defined in:
lib/bang-bang/plugins.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Set

Returns a new instance of Set.



5
6
7
# File 'lib/bang-bang/plugins.rb', line 5

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/bang-bang/plugins.rb', line 4

def config
  @config
end

Instance Method Details

#initObject



18
19
20
21
22
# File 'lib/bang-bang/plugins.rb', line 18

def init
  self.on_init.each do |block|
    block.call(config)
  end
end

#on_init(&block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/bang-bang/plugins.rb', line 9

def on_init(&block)
  @on_init ||= []
  if block
    @on_init.push(block)
  else
    @on_init
  end
end