Module: Sus::File
- Extended by:
- Context
- Defined in:
- lib/sus/file.rb
Instance Attribute Summary
Attributes included from Context
#children, #description, #identity
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Context
add, after, around, before, call, describe, each, empty?, file, full_name, include_context, inspect, it, it_behaves_like, leaf?, let, set_temporary_name, to_s, with
Class Method Details
.[](path) ⇒ Object
27
28
29
|
# File 'lib/sus/file.rb', line 27
def self.[] path
self.build(Sus.base, path)
end
|
.build(parent, path) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/sus/file.rb', line 35
def self.build(parent, path)
base = Class.new(parent)
base.extend(File)
base.description = path
base.identity = Identity.file(parent.identity, path)
base.set_temporary_name("#{self}[#{path}]")
begin
TOPLEVEL_CLASS_EVAL.call(base, path)
rescue StandardError, LoadError, SyntaxError => error
base.add FileLoadError.build(self, path, error)
end
return base
end
|
.extended(base) ⇒ Object
31
32
33
|
# File 'lib/sus/file.rb', line 31
def self.extended(base)
base.children = Hash.new
end
|
Instance Method Details
#print(output) ⇒ Object
53
54
55
|
# File 'lib/sus/file.rb', line 53
def print(output)
output.write("file ", :path, self.identity, :reset)
end
|