Module: EacRubyBase1::RootModuleSetup::Paths

Defined in:
lib/eac_ruby_base1/root_module_setup/paths.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#root_module_filePathname

Returns Absolute path to the gem's module root file.

Returns:

  • (Pathname)

    Absolute path to the gem's module root file.



9
10
11
# File 'lib/eac_ruby_base1/root_module_setup/paths.rb', line 9

def root_module_file
  @root_module_file
end

Instance Method Details

#relative_root_module_filePathname

Returns:

  • (Pathname)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eac_ruby_base1/root_module_setup/paths.rb', line 12

def relative_root_module_file
  count = 0
  current = root_module_file.basename('.*')
  dirname = root_module_file.dirname
  loop do
    ibr if dirname.root?

    break current if dirname.basename.to_path == LIB_DIRECTORY_BASENAME

    current = dirname.basename.join(current)
    dirname = dirname.dirname

    count += 1
  end
end

#root_module_directoryPathname

Returns:

  • (Pathname)


29
30
31
# File 'lib/eac_ruby_base1/root_module_setup/paths.rb', line 29

def root_module_directory
  root_module_file.basename('.*').expand_path(root_module_file.dirname)
end