Sha256: 6249935d2ee5956a8c75295221d2fa38f1d4575d743e5b079c74a400de7883fd

Contents?: true

Size: 829 Bytes

Versions: 6

Compression:

Stored size: 829 Bytes

Contents

module Vertebrae
  module Base
    def logger
      @@logger ||= Logger.new(STDOUT)
    end

    def logger=(logger)
      @@logger = logger
    end

    class << self
      def logger
        @@logger ||= Logger.new(STDOUT)
      end

      def logger=(logger)
        @@logger = logger
      end
    end

    # implement this in your api
    #
    def new(options = {}, &block)
      raise "implement me!"
    end

    def method_missing(method, *args, &block)
      return super unless new.respond_to?(method)
      new.send(method, *args, &block)
    end

    def respond_to?(method, include_private = false)
      # Avoid infinite loop error when attempting to stub the `new` method
      return true if method.to_s == 'new'

      new.respond_to?(method, include_private) || super(method, include_private)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vertebrae-0.6.0 lib/base.rb
vertebrae-0.5.1 lib/base.rb
vertebrae-0.5.0 lib/base.rb
vertebrae-0.4.3 lib/base.rb
vertebrae-0.4.2 lib/base.rb
vertebrae-0.4.1 lib/base.rb