Class: CKick::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/ckick/path.rb

Overview

Represents a file system path, it must exist

Direct Known Subclasses

IncludePath, LibraryPath

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (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_elementObject

converts to hash-serializable element



26
27
28
# File 'lib/ckick/path.rb', line 26

def to_hash_element
  @path
end

#to_sObject

returns path as is



21
22
23
# File 'lib/ckick/path.rb', line 21

def to_s
  @path
end