Class: CKick::Path
- Inherits:
-
Object
- Object
- CKick::Path
- Defined in:
- lib/ckick/path.rb
Overview
Represents a file system path, it must exist
Direct Known Subclasses
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Path
constructor
initializes path, path must exist.
-
#to_hash_element ⇒ Object
converts to hash-serializable element.
-
#to_s ⇒ Object
returns path as is.
Constructor Details
#initialize(args = {}) ⇒ Path
initializes path, path must exist
13 14 15 16 17 18 |
# File 'lib/ckick/path.rb', line 13 def initialize args={} raise IllegalInitializationError, "needs :path parameter" unless args.is_a?(Hash) && args[:path].is_a?(String) raise NoSuchDirectoryError, "invalid path #{args[:path]}" unless Dir.exist?(args[:path]) @path = args[:path] end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/ckick/path.rb', line 10 def path @path end |
Instance Method Details
#to_hash_element ⇒ Object
converts to hash-serializable element
26 27 28 |
# File 'lib/ckick/path.rb', line 26 def to_hash_element @path end |
#to_s ⇒ Object
returns path as is
21 22 23 |
# File 'lib/ckick/path.rb', line 21 def to_s @path end |