Sha256: 72efac13a0bd231d7975741a88cc6c226bdb0243243b5fbba12c280960132311

Contents?: true

Size: 629 Bytes

Versions: 9

Compression:

Stored size: 629 Bytes

Contents

module Objection
  module Awoken
    def self.included(base)
      base.send :extend, ClassMethods
      base.send :include, InstanceMethods
    end

    module InstanceMethods
      def awakeFromObjection
        # self.send :awoke_from_objection if self.respond_to? :awoke_from_objection
        if self.class._incantations
          self.class._incantations.each do |proc|
            instance_eval &proc
          end
        end
      end
    end
    
    module ClassMethods
      attr_reader :_incantations
      def awoken(&block)
        @_incantations ||= []
        @_incantations << block
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
motion-objection-0.8.6 lib/motion-objection/awoken.rb
motion-objection-0.8.5 lib/motion-objection/awoken.rb
motion-objection-0.8.4 lib/motion-objection/awoken.rb
motion-objection-0.8.3 lib/motion-objection/awoken.rb
motion-objection-0.8.2 lib/motion-objection/awoken.rb
motion-objection-0.8.1 lib/motion-objection/awoken.rb
motion-objection-0.8 lib/motion-objection/awoken.rb
motion-objection-0.7.2 lib/motion-objection/awoken.rb
motion-objection-0.7.1 lib/motion-objection/awoken.rb