Class: Rubysmith::Pathway
- Inherits:
-
Struct
- Object
- Struct
- Rubysmith::Pathway
- Defined in:
- lib/rubysmith/pathway.rb
Overview
Represents a pathway which has source start and destination end.
Instance Attribute Summary collapse
-
#end_root ⇒ Object
Returns the value of attribute end_root.
-
#start_path ⇒ Object
Returns the value of attribute start_path.
-
#start_root ⇒ Object
Returns the value of attribute start_root.
Instance Method Summary collapse
- #end_path ⇒ Object
-
#initialize(*arguments) ⇒ Pathway
constructor
:reek:TooManyStatements.
- #partial? ⇒ Boolean
- #with(attributes) ⇒ Object
Constructor Details
#initialize(*arguments) ⇒ Pathway
:reek:TooManyStatements
11 12 13 14 15 16 |
# File 'lib/rubysmith/pathway.rb', line 11 def initialize *arguments super each_pair { |key, value| self[key] = Pathname value } self[:start_path] = start_path.absolute? ? start_path : start_root.join(start_path) freeze end |
Instance Attribute Details
#end_root ⇒ Object
Returns the value of attribute end_root
7 8 9 |
# File 'lib/rubysmith/pathway.rb', line 7 def end_root @end_root end |
#start_path ⇒ Object
Returns the value of attribute start_path
7 8 9 |
# File 'lib/rubysmith/pathway.rb', line 7 def start_path @start_path end |
#start_root ⇒ Object
Returns the value of attribute start_root
7 8 9 |
# File 'lib/rubysmith/pathway.rb', line 7 def start_root @start_root end |
Instance Method Details
#end_path ⇒ Object
20 |
# File 'lib/rubysmith/pathway.rb', line 20 def end_path = end_root.join(from_parent, start_path.basename) |
#partial? ⇒ Boolean
22 |
# File 'lib/rubysmith/pathway.rb', line 22 def partial? = start_path.basename.fnmatch?("_*") |
#with(attributes) ⇒ Object
18 |
# File 'lib/rubysmith/pathway.rb', line 18 def with(attributes) = self.class.new(to_h.merge(attributes)) |