Class: Mortar::Project::Script

Inherits:
Object
  • Object
show all
Defined in:
lib/mortar/project.rb

Direct Known Subclasses

ControlScript, LuigiScript, PigScript

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path) ⇒ Script

Returns a new instance of Script.



186
187
188
189
# File 'lib/mortar/project.rb', line 186

def initialize(name, path)
  @name = name
  @path = path
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



183
184
185
# File 'lib/mortar/project.rb', line 183

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



184
185
186
# File 'lib/mortar/project.rb', line 184

def path
  @path
end

Instance Method Details

#codeObject



191
192
193
194
195
196
# File 'lib/mortar/project.rb', line 191

def code
  script_file = File.open(@path, "r")
  script_contents = script_file.read
  script_file.close
  script_contents
end

#to_sObject



198
199
200
# File 'lib/mortar/project.rb', line 198

def to_s
  code
end