Class: Envo::PathVal
- Inherits:
-
Object
- Object
- Envo::PathVal
- Defined in:
- lib/envo/val/path_val.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #accept_assign?(other) ⇒ Boolean
- #clean! ⇒ Object
-
#initialize(host, str) ⇒ PathVal
constructor
A new instance of PathVal.
- #invalid_description ⇒ Object
- #list? ⇒ Boolean
- #pretty_print(ctx) ⇒ Object
- #to_env_s ⇒ Object
- #to_list ⇒ Object
- #to_s ⇒ Object
-
#type ⇒ Object
casts.
Constructor Details
#initialize(host, str) ⇒ PathVal
Returns a new instance of PathVal.
3 4 5 6 |
# File 'lib/envo/val/path_val.rb', line 3 def initialize(host, str) @host = host @path = str end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/envo/val/path_val.rb', line 7 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/envo/val/path_val.rb', line 8 def path @path end |
Instance Method Details
#accept_assign?(other) ⇒ Boolean
13 14 15 |
# File 'lib/envo/val/path_val.rb', line 13 def accept_assign?(other) other.type == type end |
#clean! ⇒ Object
37 38 39 |
# File 'lib/envo/val/path_val.rb', line 37 def clean! @path = nil if @path && !@path.empty? && !@host.path_exists?(@path) end |
#invalid_description ⇒ Object
16 17 18 |
# File 'lib/envo/val/path_val.rb', line 16 def invalid_description @host.path_exists?(@path) ? nil : 'non-existing path' end |
#list? ⇒ Boolean
19 20 21 |
# File 'lib/envo/val/path_val.rb', line 19 def list? false end |
#pretty_print(ctx) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/envo/val/path_val.rb', line 28 def pretty_print(ctx) ctx.puts @path inv = invalid_description return if !inv ctx.warn "Warning: #{inv}" end |
#to_env_s ⇒ Object
34 35 36 |
# File 'lib/envo/val/path_val.rb', line 34 def to_env_s @path end |
#to_list ⇒ Object
22 23 24 |
# File 'lib/envo/val/path_val.rb', line 22 def to_list return PathListVal.new(@host, [@path]) end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/envo/val/path_val.rb', line 25 def to_s @path end |
#type ⇒ Object
casts
10 11 12 |
# File 'lib/envo/val/path_val.rb', line 10 def type :path end |