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, #attach_listeners_listener, #broadcast_event, #detach_listener, #detach_listeners_listener, #process_event

Constructor Details

#initialize(_event, _details) ⇒ EventWatcherForGem

Returns a new instance of EventWatcherForGem.



2862
2863
2864
2865
2866
2867
# File 'lib/a-core.rb', line 2862

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

Instance Method Details

#enhanceObject



2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
# File 'lib/a-core.rb', line 2868

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