lib/bhook/directory.rb in bhook-0.2.2 vs lib/bhook/directory.rb in bhook-0.3.0

- old
+ new

@@ -6,19 +6,19 @@ extend T::Sig GIT_DIR = '.git' MD_EXT = '.md' - sig { params(src_path: Pathname, out_path: Pathname).returns(Bhook::Directory) } + sig { params(src_path: Pathname, out_path: Pathname).returns(Bhook::RootDirectory) } def self.new_root_directory(src_path, out_path) - new(src_path, out_path, Git.open(src_path), Bhook::Config.new(src_path)) + RootDirectory.new(src_path, out_path) end sig { params(src_path: Pathname, out_path: Pathname, git: Git::Base, config: Bhook::Config).void } def initialize(src_path, out_path, git, config) @src_path = src_path - @out_path = T.let(out_path.join(src_path.basename), Pathname) + @out_path = T.let(build_out_path(src_path, out_path), Pathname) @git = git @config = config @sub_dirs = T.let([], T::Array[Directory]) @md_files = T.let([], T::Array[MdFile]) build_next_level_nodes @@ -43,9 +43,14 @@ def to_s @src_path.to_s end private + + sig { params(src_path: Pathname, out_path: Pathname).returns(Pathname) } + def build_out_path(src_path, out_path) + out_path.join(src_path.basename) + end sig { void } def build_next_level_nodes children = @src_path.children children.delete(@src_path.join(GIT_DIR))