Sha256: f2c7c95cfcd2a17f9b3ac76006aeba2d7662e87a934921055f2ec66dd0254cd1

Contents?: true

Size: 583 Bytes

Versions: 9

Compression:

Stored size: 583 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

9 entries across 9 versions & 1 rubygems

Version Path
activegraph-12.0.0.beta.5 lib/active_graph/core/wrappable.rb
activegraph-12.0.0.beta.4 lib/active_graph/core/wrappable.rb
activegraph-11.5.0.beta.3 lib/active_graph/core/wrappable.rb
activegraph-12.0.0.beta.3 lib/active_graph/core/wrappable.rb
activegraph-12.0.0.beta.2 lib/active_graph/core/wrappable.rb
activegraph-11.5.0.beta.2 lib/active_graph/core/wrappable.rb
activegraph-12.0.0.beta.1 lib/active_graph/core/wrappable.rb
activegraph-11.5.0.beta.1 lib/active_graph/core/wrappable.rb
activegraph-11.5.0.alpha.1 lib/active_graph/core/wrappable.rb