Class: Litbuild::Visitor
- Inherits:
-
Object
show all
- Defined in:
- lib/litbuild/visitor.rb
Overview
This is the base class for Litubild Visitors; it defines a no-operation Visitor. Each Visitor subclass encapsulates one of the operations that can be performed on a Blueprint along with its dependencies and components (and along with the dependencies and components of those Blueprints and so on).
Instance Method Summary
collapse
Constructor Details
#initialize(directory: '/') ⇒ Visitor
The main Visitor classes (bash script, asciidoc) write files to specific directories, and need to be able to switch to subdirectories tmeporarily; so Litbuild::Visitor has some functionality to support that.
The default ‘/’ value is just to avoid nil checking for Visitors that don’t need this feature.
18
19
20
|
# File 'lib/litbuild/visitor.rb', line 18
def initialize(directory: '/')
@dir_stack = [directory]
end
|
Instance Method Details
#in_subdirectory(subdir) ⇒ Object
22
23
24
25
26
|
# File 'lib/litbuild/visitor.rb', line 22
def in_subdirectory(subdir)
@dir_stack.push(File.join(cwd, subdir))
yield
@dir_stack.pop
end
|
#visit_commands(commands:) ⇒ Object
28
|
# File 'lib/litbuild/visitor.rb', line 28
def visit_commands(commands:); end
|
#visit_narrative(narrative:) ⇒ Object
30
|
# File 'lib/litbuild/visitor.rb', line 30
def visit_narrative(narrative:); end
|
#visit_package(package:) ⇒ Object
32
|
# File 'lib/litbuild/visitor.rb', line 32
def visit_package(package:); end
|
#visit_section(section:) ⇒ Object
34
|
# File 'lib/litbuild/visitor.rb', line 34
def visit_section(section:); end
|