Class: Mortar::Project::Script
- Inherits:
-
Object
- Object
- Mortar::Project::Script
show all
- Defined in:
- lib/mortar/project.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name, path) ⇒ Script
211
212
213
214
|
# File 'lib/mortar/project.rb', line 211
def initialize(name, path)
@name = name
@path = path
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
208
209
210
|
# File 'lib/mortar/project.rb', line 208
def name
@name
end
|
#path ⇒ Object
Returns the value of attribute path.
209
210
211
|
# File 'lib/mortar/project.rb', line 209
def path
@path
end
|
Instance Method Details
#code ⇒ Object
216
217
218
219
220
221
|
# File 'lib/mortar/project.rb', line 216
def code
script_file = File.open(@path, "r")
script_contents = script_file.read
script_file.close
script_contents
end
|
#rel_path ⇒ Object
223
224
225
226
|
# File 'lib/mortar/project.rb', line 223
def rel_path
p = Pathname.new(@path).dirname
rel_path = p.relative_path_from(Pathname.pwd).to_s
end
|
#to_s ⇒ Object
228
229
230
|
# File 'lib/mortar/project.rb', line 228
def to_s
code
end
|