Sha256: 8716eb3803c465281f8961af7d7735f170835c21b9d597e9da8b02ff6af528f6

Contents?: true

Size: 651 Bytes

Versions: 5

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true

require 'duckface/constants'

module Duckface
  module ActsAsInterface
    def exclude_methods_from_interface_enforcement(*method_names)
      class_variable_set(:@@unenforced_methods, method_names)
    end

    def methods_that_should_be_implemented
      expected_public_instance_methods = public_instance_methods(false)
      unenforced_methods = begin
                             class_variable_get(:@@unenforced_methods)
                           rescue NameError
                             []
                           end
      expected_public_instance_methods - (unenforced_methods || [])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
duckface-interfaces-0.0.5 lib/duckface/acts_as_interface.rb
duckface-interfaces-0.0.4 lib/duckface/acts_as_interface.rb
duckface-interfaces-0.0.3 lib/duckface/acts_as_interface.rb
duckface-interfaces-0.0.2 lib/duckface/acts_as_interface.rb
duckface-interfaces-0.0.1 lib/duckface/acts_as_interface.rb