Class: Stringup::Script
- Inherits:
-
Object
- Object
- Stringup::Script
- Defined in:
- lib/stringup/script.rb
Defined Under Namespace
Classes: Builder
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
4 5 6 |
# File 'lib/stringup/script.rb', line 4 def command @command end |
Class Method Details
.evaluate(text, path) ⇒ Object
10 11 12 13 14 |
# File 'lib/stringup/script.rb', line 10 def self.evaluate(text, path) script = new Builder.new(script).instance_eval(text, path, 1) script end |
.evaluate_file(path) ⇒ Object
6 7 8 |
# File 'lib/stringup/script.rb', line 6 def self.evaluate_file(path) evaluate(File.read(path), path) end |
Instance Method Details
#<<(scenario) ⇒ Object
16 17 18 |
# File 'lib/stringup/script.rb', line 16 def <<(scenario) scenarios[scenario.name.to_sym] = scenario end |
#[](name) ⇒ Object
24 25 26 |
# File 'lib/stringup/script.rb', line 24 def [](name) scenarios[name.to_sym] end |
#scenarios ⇒ Object
20 21 22 |
# File 'lib/stringup/script.rb', line 20 def scenarios @scenarios ||= {} end |
#validate! ⇒ Object
28 29 30 31 32 |
# File 'lib/stringup/script.rb', line 28 def validate! unless @command abort "ERROR: The command was not set.\n\nExample:\n\n command 'cat %s'" end end |