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
-
#extensions ⇒ Object
A list of file extensions that this ExtensionHandler handles.
-
#handler_class ⇒ Object
readonly
The class to invoke to handle compiling a file extension specified in this ExtensionHandler.
-
#usurps ⇒ Object
A list of file extensions that this ExtensionHandler usurps.
Instance Method Summary collapse
-
#<<(file_extension) ⇒ Object
Alias to add a file extension.
-
#include?(file_extension) ⇒ Boolean
Returns true if this ExtensionHandler can handle the specified file extension.
-
#initialize(**kwargs) ⇒ ExtensionHandler
constructor
A new instance of ExtensionHandler.
-
#is_a_workspace? ⇒ Boolean
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
#initialize(**kwargs) ⇒ ExtensionHandler
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
#extensions ⇒ Object
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 |
#handler_class ⇒ Object (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 |
#usurps ⇒ Object
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
#<<(file_extension) ⇒ Object
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 |
#include?(file_extension) ⇒ Boolean
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 |
#is_a_workspace? ⇒ Boolean
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 |