Class: Incept::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/incept/directory.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Directory

Returns a new instance of Directory.



8
9
10
# File 'lib/incept/directory.rb', line 8

def initialize(path)
  @path = path
end

Class Method Details

.names_for(path) ⇒ Object



4
5
6
# File 'lib/incept/directory.rb', line 4

def self.names_for(path)
  Dir.new(path).entries.reject {|d| %w(. ..).include?(d) }
end

Instance Method Details

#optionsObject



16
17
18
# File 'lib/incept/directory.rb', line 16

def options
  self.class.names_for(@path)
end

#package_nameObject



12
13
14
# File 'lib/incept/directory.rb', line 12

def package_name
  @path.match(%r{/([^/]+)$})[1]
end

#to_hashObject



20
21
22
# File 'lib/incept/directory.rb', line 20

def to_hash
  {package_name => options}
end