lib/truck/context.rb in truck-0.8.6 vs lib/truck/context.rb in truck-0.8.7

- old
+ new

@@ -1,10 +1,10 @@ module Truck class Context attr :autoload_paths, :name, :root - def initialize(name, parent: nil, root:, autoload_paths: ['.']) + def initialize(name, root, parent, autoload_paths) @name = name @root = Pathname(root) @parent = parent @autoload_paths = expand_autoload_paths autoload_paths end @@ -47,26 +47,22 @@ def parent return Object unless @parent Truck.contexts.fetch(@parent.to_sym).mod end - def resolve_const(expanded_const, skip: nil) + def resolve_const(expanded_const, skip = nil) build_const_resolver(expanded_const, Array[skip]).resolve end def shutdown! parent.send :remove_const, name end private def build_const_resolver(expanded_const, skip_files) - ConstResolver.new( - context: self, - expanded_const: String(expanded_const).dup.freeze, - skip_files: skip_files, - ) + ConstResolver.new self, String(expanded_const).dup.freeze, skip_files end def build_mod mod = Module.new mod.singleton_class.class_exec root do |__root__| @@ -82,10 +78,10 @@ end class AutoloadError < NameError attr :const, :rb_file - def initialize(const:, rb_file:) + def initialize(const, rb_file) @const = const @rb_file = rb_file end def message