lib/lotus/utils/load_paths.rb in lotus-utils-0.2.0 vs lib/lotus/utils/load_paths.rb in lotus-utils-0.3.0

- old
+ new

@@ -13,11 +13,11 @@ # # @return [Lotus::Utils::LoadPaths] self # # @since 0.2.0 # - # @see http://ruby-doc.org/stdlib-2.1.2/libdoc/pathname/rdoc/Pathname.html + # @see http://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html # @see Lotus::Utils::Kernel.Pathname def initialize(*paths) @paths = Array(paths) end @@ -25,12 +25,12 @@ # or #dup are invoked. # # @api private # @since 0.2.0 # - # @see http://ruby-doc.org/core-2.1.2/Object.html#method-i-clone - # @see http://ruby-doc.org/core-2.1.2/Object.html#method-i-dup + # @see http://ruby-doc.org/core/Object.html#method-i-clone + # @see http://ruby-doc.org/core/Object.html#method-i-dup # # @example # require 'lotus/utils/load_paths' # # paths = Lotus::Utils::LoadPaths.new '.' @@ -50,20 +50,21 @@ # Iterates thru the collection and yields the given block. # It skips duplications and raises an error in case one of the paths # doesn't exist. # - # @param blk [Proc] the block of code to be yielded + # @yield [pathname] the block of code that acts on the collection + # @yieldparam pathname [Pathname] # # @return [void] # # @raise [Errno::ENOENT] if one of the paths doesn't exist # # @since 0.2.0 - def each(&blk) + def each Utils::Kernel.Array(@paths).each do |path| - blk.call realpath(path) + yield realpath(path) end end # Adds the given path(s). # @@ -76,11 +77,11 @@ # # @raise [RuntimeError] if the object was previously frozen # # @since 0.2.0 # - # @see http://ruby-doc.org/stdlib-2.1.2/libdoc/pathname/rdoc/Pathname.html + # @see http://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html # @see Lotus::Utils::Kernel.Pathname # @see Lotus::Utils::LoadPaths#freeze # # @example Basic usage # require 'lotus/utils/load_paths' @@ -117,10 +118,10 @@ # It freezes the object by preventing further modifications. # # @since 0.2.0 # - # @see http://ruby-doc.org/core-2.1.2/Object.html#method-i-freeze + # @see http://ruby-doc.org/core/Object.html#method-i-freeze # # @example # require 'lotus/utils/load_paths' # # paths = Lotus::Utils::LoadPaths.new