Module: MissileEmitter

Defined in:
lib/missile_emitter.rb,
lib/missile_emitter/version.rb,
lib/missile_emitter/attributes.rb,
lib/missile_emitter/searchable.rb,
lib/missile_emitter/battle_field.rb,
lib/missile_emitter/configurable.rb

Defined Under Namespace

Modules: Attributes, Configurable, Searchable Classes: BattleField, Error

Constant Summary collapse

VERSION =
"0.4.10"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.mappingObject

Returns the value of attribute mapping.



17
18
19
# File 'lib/missile_emitter.rb', line 17

def mapping
  @mapping
end

Class Method Details

.exec(namespace, &block) ⇒ Object

Raises:



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/missile_emitter.rb', line 19

def exec(namespace, &block)
  raise Error, '需要提供代码块' unless block

  context = block.binding.receiver

  raise Error, '只能再具名模块中调用' unless context.instance_of?(Module) && context.name

  mimic_method context, namespace: namespace

  mapping[context] = block
end