Class: NetLinx::Compile::ExtensionHandler
- Inherits:
-
Object
- Object
- NetLinx::Compile::ExtensionHandler
- Defined in:
- lib/netlinx/compile/extension_handler.rb
Overview
Tells netlinx-compile which class handles the compiling of a set of file extensions.
Instance Attribute Summary (collapse)
-
- (Object) extensions
A list of file extensions that this ExtensionHandler handles.
-
- (Object) handler_class
readonly
The class to invoke to handle compiling a file extension specified in this ExtensionHandler.
-
- (Object) usurps
A list of file extensions that this ExtensionHandler usurps.
Instance Method Summary (collapse)
-
- (Object) <<(file_extension)
Alias to add a file extension.
-
- (Boolean) include?(file_extension)
Returns true if this ExtensionHandler can handle the specified file extension.
-
- (ExtensionHandler) initialize(**kwargs)
constructor
A new instance of ExtensionHandler.
-
- (Boolean) is_a_workspace?
Workspace files are significant because they contain information about a project, connection settings for a master, and possibly multiple systems that need to be compiled.
Constructor Details
- (ExtensionHandler) initialize(**kwargs)
Returns a new instance of ExtensionHandler
35 36 37 38 39 40 |
# File 'lib/netlinx/compile/extension_handler.rb', line 35 def initialize(**kwargs) @extensions = kwargs.fetch :extensions, [] @usurps = kwargs.fetch :usurps, [] @is_a_workspace = kwargs.fetch :is_a_workspace, false @handler_class = kwargs.fetch :handler_class, nil end |
Instance Attribute Details
- (Object) extensions
A list of file extensions that this ExtensionHandler handles.
7 8 9 |
# File 'lib/netlinx/compile/extension_handler.rb', line 7 def extensions @extensions end |
- (Object) handler_class (readonly)
The class to invoke to handle compiling a file extension specified in this ExtensionHandler.
16 17 18 |
# File 'lib/netlinx/compile/extension_handler.rb', line 16 def handler_class @handler_class end |
- (Object) usurps
A list of file extensions that this ExtensionHandler usurps. For example, third-party workspace extensions would probably usurp the .apw workspace extension.
12 13 14 |
# File 'lib/netlinx/compile/extension_handler.rb', line 12 def usurps @usurps end |
Instance Method Details
- (Object) <<(file_extension)
Alias to add a file extension.
43 44 45 |
# File 'lib/netlinx/compile/extension_handler.rb', line 43 def <<(file_extension) @extensions << parse_extension(file_extension) end |
- (Boolean) include?(file_extension)
Returns true if this NetLinx::Compile::ExtensionHandler can handle the specified file extension.
62 63 64 |
# File 'lib/netlinx/compile/extension_handler.rb', line 62 def include?(file_extension) @extensions.include? parse_extension(file_extension) end |
- (Boolean) is_a_workspace?
Workspace files are significant because they contain information about a project, connection settings for a master, and possibly multiple systems that need to be compiled. Therefore, when smart-compiling, workspaces need to be distinguished from source code files because discovering a workspace should be considered a better match than discovering a source code file.
56 57 58 |
# File 'lib/netlinx/compile/extension_handler.rb', line 56 def is_a_workspace? @is_a_workspace end |