Class: Kettle::Jem::FileWorkUnit
- Inherits:
-
Object
- Object
- Kettle::Jem::FileWorkUnit
- Defined in:
- lib/kettle/jem.rb
Instance Attribute Summary collapse
-
#operations ⇒ Object
readonly
Returns the value of attribute operations.
-
#relative_path ⇒ Object
readonly
Returns the value of attribute relative_path.
Instance Method Summary collapse
-
#initialize(relative_path:, operations:) ⇒ FileWorkUnit
constructor
A new instance of FileWorkUnit.
- #outcome ⇒ Object
Constructor Details
#initialize(relative_path:, operations:) ⇒ FileWorkUnit
Returns a new instance of FileWorkUnit.
1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 |
# File 'lib/kettle/jem.rb', line 1844 def initialize(relative_path:, operations:) @relative_path = relative_path.to_s @operations = Array(operations) raise ArgumentError, "File work unit requires at least one operation" if @operations.empty? mismatched_paths = @operations.reject { |operation| operation.relative_path == @relative_path } return if mismatched_paths.empty? paths = mismatched_paths.map(&:relative_path).uniq.join(", ") raise ArgumentError, "File work unit #{relative_path.inspect} cannot include operations for #{paths}" end |
Instance Attribute Details
#operations ⇒ Object (readonly)
Returns the value of attribute operations.
1842 1843 1844 |
# File 'lib/kettle/jem.rb', line 1842 def operations @operations end |
#relative_path ⇒ Object (readonly)
Returns the value of attribute relative_path.
1842 1843 1844 |
# File 'lib/kettle/jem.rb', line 1842 def relative_path @relative_path end |
Instance Method Details
#outcome ⇒ Object
1856 1857 1858 |
# File 'lib/kettle/jem.rb', line 1856 def outcome operations.last end |