Sha256: 5c454f50c48dbb1eea86191c4d1a9dd7d0208e6201ee39dbc2726beaa3fb0819

Contents?: true

Size: 582 Bytes

Versions: 34

Compression:

Stored size: 582 Bytes

Contents

module ActiveGraph
  module Core
    module Wrappable
      extend ActiveSupport::Concern

      def wrap
        self.class.wrap(self)
      end

      class_methods do
        def wrapper_callback(proc)
          fail 'Callback already specified!' if @wrapper_callback
          @wrapper_callback = proc
        end

        def clear_wrapper_callback
          @wrapper_callback = nil
        end

        def wrap(node)
          if @wrapper_callback
            @wrapper_callback.call(node)
          else
            node
          end
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
activegraph-11.4.0 lib/active_graph/core/wrappable.rb
activegraph-11.3.1 lib/active_graph/core/wrappable.rb
activegraph-11.3.0 lib/active_graph/core/wrappable.rb
activegraph-11.2.0 lib/active_graph/core/wrappable.rb
activegraph-11.1.0 lib/active_graph/core/wrappable.rb
activegraph-11.1.0.beta.1 lib/active_graph/core/wrappable.rb
activegraph-11.1.0.alpha.4 lib/active_graph/core/wrappable.rb
activegraph-11.1.0.alpha.3 lib/active_graph/core/wrappable.rb
activegraph-11.1.0.alpha.2 lib/active_graph/core/wrappable.rb
activegraph-11.1.0.alpha.1 lib/active_graph/core/wrappable.rb
activegraph-10.2.0.beta.1 lib/active_graph/core/wrappable.rb
activegraph-11.0.2-java lib/active_graph/core/wrappable.rb
activegraph-10.1.1 lib/active_graph/core/wrappable.rb
activegraph-11.0.1-java lib/active_graph/core/wrappable.rb
activegraph-11.0.0-java lib/active_graph/core/wrappable.rb
activegraph-10.1.0 lib/active_graph/core/wrappable.rb
activegraph-11.0.0.beta.4-java lib/active_graph/core/wrappable.rb
activegraph-10.0.2 lib/active_graph/core/wrappable.rb
activegraph-11.0.0.beta.3-java lib/active_graph/core/wrappable.rb
activegraph-11.0.0.beta.2-java lib/active_graph/core/wrappable.rb