Module: HaveAPI::Fs::Help

Included in:
Components::Directory
Defined in:
lib/haveapi/fs/help.rb

Overview

Included this module to a Component to provide help files. All components based on Components::Directory already have this module included.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

SEARCH_PATH =

When searching for a help file, all directories in this list are checked. Add paths to this list for help files of third-party components.

[
    ::File.realpath(::File.join(
        ::File.dirname(__FILE__),
        '..', '..', '..',
        'templates',
        'help',
    ))
]

Class Method Summary collapse

Class Method Details

.find!(name) ⇒ String

Search for name in paths defined in SEARCH_PATH.

Returns:

Raises:

  • (Errno::ENOENT)


80
81
82
83
84
85
86
87
88
# File 'lib/haveapi/fs/help.rb', line 80

def find!(name)
  SEARCH_PATH.each do |s|
    path = ::File.join(s, name)

    return path if ::File.exists?(path)
  end

  raise Errno::ENOENT, "help file '#{name}' not found"
end

.included(klass) ⇒ Object



73
74
75
76
# File 'lib/haveapi/fs/help.rb', line 73

def included(klass)
  klass.send(:extend, ClassMethods)
  klass.send(:include, InstanceMethods)
end