Class: Guard::Tilt::OutputPath
- Inherits:
-
Struct
- Object
- Struct
- Guard::Tilt::OutputPath
- Defined in:
- lib/guard/tilt/output_path.rb
Instance Attribute Summary collapse
-
#to_str ⇒ Object
Returns the value of attribute to_str.
Instance Method Summary collapse
- #basename(*args) ⇒ Object
- #dirname ⇒ Object
- #expand(*args) ⇒ Object
- #extname ⇒ Object
- #join(other) ⇒ Object
- #open(mode = 'r', &block) ⇒ Object
-
#sanitize ⇒ Object
Template Method.
- #strip_extname ⇒ Object
- #sub(base, root) ⇒ Object
- #to_s(base = nil) ⇒ Object
Instance Attribute Details
#to_str ⇒ Object
Returns the value of attribute to_str
1 2 3 |
# File 'lib/guard/tilt/output_path.rb', line 1 def to_str @to_str end |
Instance Method Details
#basename(*args) ⇒ Object
19 20 21 |
# File 'lib/guard/tilt/output_path.rb', line 19 def basename(*args) new File.basename(to_str, *args) end |
#dirname ⇒ Object
22 23 24 |
# File 'lib/guard/tilt/output_path.rb', line 22 def dirname new File.dirname(to_str) end |
#expand(*args) ⇒ Object
25 26 27 |
# File 'lib/guard/tilt/output_path.rb', line 25 def (*args) new File.(to_str, *args) end |
#extname ⇒ Object
16 17 18 |
# File 'lib/guard/tilt/output_path.rb', line 16 def extname new File.extname(to_str) end |
#join(other) ⇒ Object
9 10 11 |
# File 'lib/guard/tilt/output_path.rb', line 9 def join(other) new File.join(to_str, other.to_str) end |
#open(mode = 'r', &block) ⇒ Object
41 42 43 |
# File 'lib/guard/tilt/output_path.rb', line 41 def open(mode = 'r', &block) File.open(to_s, mode, &block) end |
#sanitize ⇒ Object
Template Method
5 6 7 |
# File 'lib/guard/tilt/output_path.rb', line 5 def sanitize strip_extname end |
#strip_extname ⇒ Object
29 30 31 |
# File 'lib/guard/tilt/output_path.rb', line 29 def strip_extname .dirname.join basename(extname) end |
#sub(base, root) ⇒ Object
12 13 14 |
# File 'lib/guard/tilt/output_path.rb', line 12 def sub(base, root) new to_str.sub(base, root) end |
#to_s(base = nil) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/guard/tilt/output_path.rb', line 33 def to_s(base = nil) unless base sanitize.to_str else base += File::Separator if base !~ /\/$/ sanitize.sub(base, '').to_str end end |