Class: Staticz::Compilable::SimpleFile
- Inherits:
-
Object
- Object
- Staticz::Compilable::SimpleFile
show all
- Includes:
- Staticz::Compilable
- Defined in:
- lib/manifest/compilable/simple_file.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#errors, #exists?, included, #path, #path_method_name, #print, #valid?, #warnings
Constructor Details
Returns a new instance of SimpleFile.
27
28
29
|
# File 'lib/manifest/compilable/simple_file.rb', line 27
def initialize(name)
@name = name
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
10
11
12
|
# File 'lib/manifest/compilable/simple_file.rb', line 10
def name
@name
end
|
Instance Method Details
#build(listener_class: nil) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/manifest/compilable/simple_file.rb', line 31
def build(listener_class: nil)
listener = listener_class&.new(self)
if exists?
File.write build_path, File.read(source_path)
listener&.finish
else
listener&.error
end
end
|
#build_path ⇒ Object
16
17
18
|
# File 'lib/manifest/compilable/simple_file.rb', line 16
def build_path
"build/#{name}"
end
|
#create_link_function ⇒ Object
20
21
22
23
24
25
|
# File 'lib/manifest/compilable/simple_file.rb', line 20
def create_link_function
link_path = "/#{name}"
Object.send(:define_method, path_method_name) { link_path }
Manifest.instance.functions << path_method_name
end
|
#source_path ⇒ Object
12
13
14
|
# File 'lib/manifest/compilable/simple_file.rb', line 12
def source_path
"src/#{name}"
end
|