Class: QED::Script
- Inherits:
-
Object
- Object
- QED::Script
- Defined in:
- lib/qed/script.rb
Overview
Script
Instance Attribute Summary collapse
-
#applique ⇒ Object
readonly
Returns the value of attribute applique.
-
#file ⇒ Object
readonly
Demonstrandum file.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #advice ⇒ Object
-
#binding ⇒ Object
One binding per script.
-
#directory ⇒ Object
Expanded dirname of
file
. -
#initialize(applique, file, scope = nil) ⇒ Script
constructor
New Script.
-
#name ⇒ Object
File basename less extension.
-
#parse ⇒ Object
def source @source ||= ( #case file #when /^http/ # ext = File.extname(file).sub(‘.’,”) # open(file) #else File.read(file) #end ) end.
- #run(*observers) ⇒ Object
Constructor Details
#initialize(applique, file, scope = nil) ⇒ Script
New Script
23 24 25 26 27 28 29 30 |
# File 'lib/qed/script.rb', line 23 def initialize(applique, file, scope=nil) @applique = applique.dup # localize copy of applique @file = file @scope = scope || Scope.new(applique) @binding = @scope.__binding__ #@loadlist = [] #apply_environment end |
Instance Attribute Details
#applique ⇒ Object (readonly)
Returns the value of attribute applique.
14 15 16 |
# File 'lib/qed/script.rb', line 14 def applique @applique end |
#file ⇒ Object (readonly)
Demonstrandum file.
17 18 19 |
# File 'lib/qed/script.rb', line 17 def file @file end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
20 21 22 |
# File 'lib/qed/script.rb', line 20 def scope @scope end |
Instance Method Details
#advice ⇒ Object
38 39 40 41 |
# File 'lib/qed/script.rb', line 38 def advice #@scope.__advice__ @applique.__advice__ end |
#binding ⇒ Object
One binding per script.
33 34 35 |
# File 'lib/qed/script.rb', line 33 def binding @binding #||= @scope.__binding__ end |
#directory ⇒ Object
Expanded dirname of file
.
44 45 46 |
# File 'lib/qed/script.rb', line 44 def directory @directory ||= File.(File.dirname(file)) end |
#name ⇒ Object
File basename less extension.
49 50 51 |
# File 'lib/qed/script.rb', line 49 def name @name ||= File.basename(file).chomp(File.extname(file)) end |