Class: M2Config::Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/m2config/dir.rb

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ Dir

Returns a new instance of Dir.

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
# File 'lib/m2config/dir.rb', line 5

def initialize( fields )
  fields[:default_ctype] ||= "application/octet-stream"
  fields[:index_file] ||= "index.html"
  raise ArgumentError, "Base directories are relative to chroot and must not start with a slash (as in your <#{fields[:base]}>)" if 
    fields[:base] =~ /^\/.+/
  raise ArgumentError, "Base directories must end with a slash (your <#{fields[:base]}> does not)" if 
    !(fields[:base] =~ /\/$/)
  super(fields, false)
  save
end

Instance Method Details

#typeObject



16
17
18
# File 'lib/m2config/dir.rb', line 16

def type
  "dir"
end