Class: Roast::ValueObjects::WorkflowPath
- Inherits:
-
Object
- Object
- Roast::ValueObjects::WorkflowPath
show all
- Defined in:
- lib/roast/value_objects/workflow_path.rb
Overview
Value object representing a workflow file path with validation and resolution
Defined Under Namespace
Classes: InvalidPathError
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of WorkflowPath.
11
12
13
14
15
16
|
# File 'lib/roast/value_objects/workflow_path.rb', line 11
def initialize(path)
@value = normalize_path(path)
@pathname = Pathname.new(@value)
validate!
freeze
end
|
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
9
10
11
|
# File 'lib/roast/value_objects/workflow_path.rb', line 9
def value
@value
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
46
47
48
49
50
|
# File 'lib/roast/value_objects/workflow_path.rb', line 46
def ==(other)
return false unless other.is_a?(WorkflowPath)
value == other.value
end
|
#absolute? ⇒ Boolean
22
23
24
|
# File 'lib/roast/value_objects/workflow_path.rb', line 22
def absolute?
pathname.absolute?
end
|
#basename ⇒ Object
34
35
36
|
# File 'lib/roast/value_objects/workflow_path.rb', line 34
def basename
pathname.basename.to_s
end
|
#dirname ⇒ Object
30
31
32
|
# File 'lib/roast/value_objects/workflow_path.rb', line 30
def dirname
pathname.dirname.to_s
end
|
#exist? ⇒ Boolean
18
19
20
|
# File 'lib/roast/value_objects/workflow_path.rb', line 18
def exist?
pathname.exist?
end
|
#hash ⇒ Object
53
54
55
|
# File 'lib/roast/value_objects/workflow_path.rb', line 53
def hash
[self.class, @value].hash
end
|
#relative? ⇒ Boolean
26
27
28
|
# File 'lib/roast/value_objects/workflow_path.rb', line 26
def relative?
pathname.relative?
end
|
#to_path ⇒ Object
42
43
44
|
# File 'lib/roast/value_objects/workflow_path.rb', line 42
def to_path
@value
end
|
#to_s ⇒ Object
38
39
40
|
# File 'lib/roast/value_objects/workflow_path.rb', line 38
def to_s
@value
end
|