Sha256: 6e9a69ce77e94db82bb21ff8d88b7b0a1b02d7c6633a9ac7d41decb245d0246f

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

module Usable
  class Config < OpenStruct
    def modules
      @modules ||= []
    end

    def available_methods
      modules.each_with_object(Hash.new(default_method)) do |mod, result|
        mod.instance_methods.each do |method_name|
          result[method_name] = mod.instance_method method_name
        end
      end
    end

    def default_method
      Null.instance_method(:null)
    end

    module Null
      def null(*, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
usable-1.0.0 lib/usable/config.rb