Class: Epuber::Plugin::PluginFile
- Inherits:
-
Compiler::FileTypes::SourceFile
- Object
- Compiler::FileTypes::AbstractFile
- Compiler::FileTypes::SourceFile
- Epuber::Plugin::PluginFile
- Defined in:
- lib/epuber/plugin.rb
Instance Attribute Summary collapse
- #instances ⇒ Array readonly
Attributes inherited from Compiler::FileTypes::SourceFile
#abs_source_path, #file_request, #source_path
Attributes inherited from Compiler::FileTypes::AbstractFile
#compilation_context, #destination_path, #final_destination_path, #group, #path_type, #pkg_destination_path, #properties
Class Method Summary collapse
Instance Method Summary collapse
-
#check { ... } ⇒ Checker
Method for creating new instance of checker in packages.
-
#initialize(file_path) ⇒ PluginFile
constructor
A new instance of PluginFile.
-
#transform { ... } ⇒ Transformer
Method for creating new instance of checker in packages.
Methods inherited from Compiler::FileTypes::SourceFile
#default_file_copy, #destination_file_exist?, #destination_file_up_to_date?, #find_dependencies, #process, #properties, resolve_relative_file, #source_file_up_to_date?, #update_metadata!, #write_compiled, #write_processed
Methods inherited from Compiler::FileTypes::AbstractFile
#==, file_copy!, write_to_file, write_to_file!, write_to_file?
Constructor Details
#initialize(file_path) ⇒ PluginFile
Returns a new instance of PluginFile.
17 18 19 20 21 22 |
# File 'lib/epuber/plugin.rb', line 17 def initialize(file_path) super(file_path) @instances = [] eval(::File.read(file_path), binding, file_path) # rubocop:disable Security/Eval end |
Instance Attribute Details
#instances ⇒ Array (readonly)
13 14 15 |
# File 'lib/epuber/plugin.rb', line 13 def instances @instances end |
Class Method Details
.plugin_instance_function(name, klass) ⇒ Object
Returns nil.
29 30 31 32 33 34 35 36 |
# File 'lib/epuber/plugin.rb', line 29 def self.plugin_instance_function(name, klass) define_method(name) do |source_type, *, &block| checker_class = klass.class_for_source_type(source_type) checker = checker_class.new(source_type, *, &block) instances << checker checker end end |
Instance Method Details
#check { ... } ⇒ Checker
Method for creating new instance of checker in packages
47 |
# File 'lib/epuber/plugin.rb', line 47 plugin_instance_function(:check, Checker) |
#transform { ... } ⇒ Transformer
Method for creating new instance of checker in packages
57 |
# File 'lib/epuber/plugin.rb', line 57 plugin_instance_function(:transform, Transformer) |