Sha256: fd8aef624de288b286ec3e34ea64d3adaf67aaf4658f4311f154accabd146fb1

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

module Pry::Config::Lazy
  LAZY_KEYS = Hash.new {|h,k| h[k] = [] }

  module ClassMethods
    def lazy_implement(method_name_to_func)
      method_name_to_func.each do |method_name, func|
        define_method(method_name) do
          if method_name_to_func[method_name].equal?(func)
            method_name_to_func[method_name] = instance_eval(&func)
          end
          method_name_to_func[method_name]
        end
      end
      LAZY_KEYS[self] |= method_name_to_func.keys
    end
  end

  def self.included(includer)
    includer.extend(ClassMethods)
  end

  def lazy_keys
    LAZY_KEYS[self.class]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pry-0.11.0.pre2 lib/pry/config/lazy.rb
pry-0.11.0.pre2-java lib/pry/config/lazy.rb
pry-0.11.0.pre lib/pry/config/lazy.rb
pry-0.11.0.pre-java lib/pry/config/lazy.rb