class Inprovise::Infrastructure::Target

Attributes

config[R]
name[R]

Public Class Methods

new(name, config = {}) click to toggle source
# File lib/inprovise/infra.rb, line 80
def initialize(name, config = {})
  @name = name
  @config = config
  Inprovise::Infrastructure.register(self)
end

Public Instance Methods

add_target(tgt) click to toggle source
# File lib/inprovise/infra.rb, line 102
def add_target(tgt)
  raise RuntimeError, "Cannot add #{tgt.to_s} to #{self.to_s}"
end
add_to(grp) click to toggle source
# File lib/inprovise/infra.rb, line 94
def add_to(grp)
  grp.add_target(self)
end
get(option) click to toggle source
# File lib/inprovise/infra.rb, line 86
def get(option)
  config[option]
end
includes?(tgt) click to toggle source
# File lib/inprovise/infra.rb, line 110
def includes?(tgt)
  false
end
remove_from(grp) click to toggle source
# File lib/inprovise/infra.rb, line 98
def remove_from(grp)
  grp.remove_target(self)
end
remove_target(tgt) click to toggle source
# File lib/inprovise/infra.rb, line 106
def remove_target(tgt)
  # ignore
end
set(option, value) click to toggle source
# File lib/inprovise/infra.rb, line 90
def set(option, value)
  config[option.to_sym] = value
end
targets() click to toggle source
# File lib/inprovise/infra.rb, line 114
def targets
  [self]
end
targets_with_config() click to toggle source
# File lib/inprovise/infra.rb, line 118
def targets_with_config
  {self => @config.dup}
end