Class: Required

Inherits:
Object
  • Object
show all
Defined in:
lib/require-dsl.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_path, path) ⇒ Required

Returns a new instance of Required.



26
27
28
29
# File 'lib/require-dsl.rb', line 26

def initialize base_path, path
  rel_path = relative_path(base_path, path)
  @location = File.dirname(rel_path) 
end

Instance Attribute Details

#locationObject

Returns the value of attribute location.



24
25
26
# File 'lib/require-dsl.rb', line 24

def location
  @location
end

#stdoutObject

Returns the value of attribute stdout.



24
25
26
# File 'lib/require-dsl.rb', line 24

def stdout
  @stdout
end

Class Method Details

.extend_files(files, required) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/require-dsl.rb', line 42

def self.extend_files files, required
  files.extend(FileListExtension).required = required 
  files.map! do |f| 
    f.extend(FileString)
    f.required = required
    f
  end 
  files
end

.glob(options) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/require-dsl.rb', line 31

def self.glob options
  case options[:recursive]
  when :full
    '**/*.rb'    
  when :single
    ['*/*.rb', '*.rb']
  else
    '*.rb'
  end
end