Class: FileDefinition
- Inherits:
-
Object
- Object
- FileDefinition
- Defined in:
- lib/file_definition.rb
Constant Summary collapse
- @@extensions_to_include_in_target =
["c", "m", "sh"]
Instance Attribute Summary collapse
-
#group_path ⇒ Object
Returns the value of attribute group_path.
-
#include_in_target ⇒ Object
Returns the value of attribute include_in_target.
-
#input_path ⇒ Object
Returns the value of attribute input_path.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
Class Method Summary collapse
Instance Method Summary collapse
- #include_in_target? ⇒ Boolean
-
#initialize(options) ⇒ FileDefinition
constructor
A new instance of FileDefinition.
Constructor Details
#initialize(options) ⇒ FileDefinition
Returns a new instance of FileDefinition.
17 18 19 20 21 22 |
# File 'lib/file_definition.rb', line 17 def initialize() @input_path = [:input_path] @group_path = [:group_path] @output_path = [:output_path] @include_in_target = [:include_in_target] end |
Instance Attribute Details
#group_path ⇒ Object
Returns the value of attribute group_path.
2 3 4 |
# File 'lib/file_definition.rb', line 2 def group_path @group_path end |
#include_in_target ⇒ Object
Returns the value of attribute include_in_target.
2 3 4 |
# File 'lib/file_definition.rb', line 2 def include_in_target @include_in_target end |
#input_path ⇒ Object
Returns the value of attribute input_path.
2 3 4 |
# File 'lib/file_definition.rb', line 2 def input_path @input_path end |
#output_path ⇒ Object
Returns the value of attribute output_path.
2 3 4 |
# File 'lib/file_definition.rb', line 2 def output_path @output_path end |
Class Method Details
.build(project_root, file_path) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/file_definition.rb', line 6 def self.build(project_root, file_path) relative_file_path = file_path.gsub("#{File.(project_root)}/", "") include_in_target = @@extensions_to_include_in_target.any? {|ext| relative_file_path.end_with?(ext)} FileDefinition.new({ :input_path => relative_file_path, :group_path => File.dirname(relative_file_path), :output_path => relative_file_path, :include_in_target => include_in_target }) end |
Instance Method Details
#include_in_target? ⇒ Boolean
24 25 26 |
# File 'lib/file_definition.rb', line 24 def include_in_target? @include_in_target end |