Class: EventWatcherForGem

Inherits:
Object
  • Object
show all
Includes:
EventBus
Defined in:
lib/a-core.rb

Instance Method Summary collapse

Methods included from EventBus

#attach_listener, #broadcast_event, #detach_listener, #process_event

Constructor Details

#initialize(_event, _details) ⇒ EventWatcherForGem

Returns a new instance of EventWatcherForGem.



1410
1411
1412
1413
1414
1415
# File 'lib/a-core.rb', line 1410

def initialize(_event, _details)
  @event=_event
  @details=_details
  enhance
  Arcadia.attach_listener(self, _event)
end

Instance Method Details

#enhanceObject



1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
# File 'lib/a-core.rb', line 1416

def enhance
  implementation=%Q{
    class << self
      def #{_method_name(@event, 'before')}(_event)
        _event.break
        new_event = Arcadia.process_event(NeedRubyGemWizardEvent.new(self, @details))
        if new_event && new_event.results
          ok=new_event.results[0].installed
          _event.break if !ok
        end
      end
    end
  }
  eval(implementation)
end