Sha256: da08e6e4c6cca27533f68a66ccff0abd4f4c7e1382e961d27bcf00b59938ae00

Contents?: true

Size: 859 Bytes

Versions: 5

Compression:

Stored size: 859 Bytes

Contents

class EcoRake
  module Options
    module Parental
      class << self
        def included(base)
          super(base)
          base.extend ClassMethods
        end
      end

      module ClassMethods
        private

        def add_to_options(opt, *args)
          super.tap do |out|
            next unless opt.respond_to?(:parent=)
            opt.parent = self if opt == out
          end
        end

        def delete_from_options(opt)
          super.tap do |out|
            next unless opt.respond_to?(:parent=)
            out.parent = nil if opt == out
          end
        end

        def replace_in_options(ref, opt, **kargs)
          super.tap do |out|
            next unless opt.respond_to?(:parent=)
            ref.parent = nil if opt == out
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eco-rake-0.1.5 lib/eco-rake/options/parental.rb
eco-rake-0.1.4 lib/eco-rake/options/parental.rb
eco-rake-0.1.3 lib/eco-rake/options/parental.rb
eco-rake-0.1.2 lib/eco-rake/options/parental.rb
eco-rake-0.1.1 lib/eco-rake/options/parental.rb