Sha256: ab261a266f7c013d8ca62a945e6bbd3633edfac96cc053dca33975138ddbb6ad

Contents?: true

Size: 597 Bytes

Versions: 6

Compression:

Stored size: 597 Bytes

Contents

module BBLib
  module Prototype
    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods
      def prototype(opts = prototype_defaults)
        @prototype ||= self.new(*prototype_defaults)
      end

      def prototype_defaults
        []
      end

      def method_missing(method, *args, &block)
        prototype.respond_to?(method) ? prototype.send(method, *args, &block) : super
      end

      def respond_to_missing?(method, include_private = false)
        prototype.respond_to?(method) || super
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bblib-2.0.5 lib/bblib/core/mixins/prototype.rb
bblib-2.0.4 lib/bblib/core/mixins/prototype.rb
bblib-2.0.3 lib/bblib/core/mixins/prototype.rb
bblib-2.0.1 lib/bblib/core/mixins/prototype.rb
bblib-2.0.0 lib/bblib/core/mixins/prototype.rb
bblib-1.0.2 lib/mixins/prototype.rb